Skip to content

Violette v0.2.0

Choose a tag to compare

@Krev3tka Krev3tka released this 29 Sep 17:44
· 20 commits to main since this release

Violette v0.2.0: Major Syntax Overhaul & Block-Scoped Defer

This release introduces significant ergonomic improvements to the language syntax, introduces block-scoped resource management, and turns if into a first-class expression.


What's New

  • Block-Scoped LIFO defer:
    Introduced Zig-style lexical defer statements. Deferred calls execute in strict Last-In-First-Out (LIFO) order upon exiting their enclosing block { ... }, on loop iterations, and before early return statements.
  • if as a First-Class Expression:
    if / else if / else can now be used as expressions to yield values.
  • Inline if Syntactic Sugar (:):
    Added optional Python/Nim-style colon syntax for concise one-liners:
    func sign(x: Int) -> Int = if x > 0: 1 else if x == 0: 0 else: -1
  • Clean Return Syntax (->):
    Replaced square brackets [Type] with standard modern arrow notation -> Type.
  • PascalCase Unified Types:
    Standardized all built-in types to PascalCase (Int, String, Float64, Bool). Removed primitive distinctions from AST.
  • Modern Algebraic Data Types (Variants):
    Redesigned variant definitions to use clean block syntax:
    variant Result { Win(Int), Fail(String) }
  • Restored Bitwise OR (|):
    Freed up | from variant definitions and restored it as the standard bitwise OR operator (replacing #).
  • Clean Module Imports (using):
    Replaced import with Haskell-like syntax: using math (sqrt, abs).
  • Standardized Ranges:
    Ranges now follow standard syntax: 0..10 (exclusive) and 0..=10 (inclusive).