Repository navigation
Violette v0.2.0
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 earlyreturnstatements. ifas a First-Class Expression:
if / else if / elsecan now be used as expressions to yield values.- Inline
ifSyntactic 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):
Replacedimportwith Haskell-like syntax:using math (sqrt, abs). - Standardized Ranges:
Ranges now follow standard syntax:0..10(exclusive) and0..=10(inclusive).