Syntax ergonomics
Familiar spellings that desugar to the same checked core. Full demo: tests/lang/ergonomics.vow.
Use case: construct with new
Section titled “Use case: construct with new”Define fn new(...) -> Type on the type, then call new Type(...):
class Counter { n: int
fn new(start: int) -> Counter { return Counter { n: start } }
fn inc(self) -> Counter { self.n = self.n + 1 return self }}
fn main(caps: Caps) -> int { var c = new Counter(0) c = c.inc().inc() return c.n}Literal Counter { n: 0 } still works.
Use case: switch / case
Section titled “Use case: switch / case”// fragment-onlyfn area(s: Shape) -> int { return switch s { case Circle(r): 3 * r * r, case Rect(w, h): w * h, }}Desugars to match — same exhaustiveness rules. match with => remains supported.
Use case: handle Result locally
Section titled “Use case: handle Result locally”// fragment-onlyfn fallible(flag: bool) -> Result<int, int> { if flag { return Ok(42) } return Err(9)}
fn main(caps: Caps) -> int { let ok_val = try fallible(true) catch (e) { e }
try { let x = fallible(false) } catch (e) { print("caught err=", e) assert e == 9 }
return ok_val}Also: ? propagates Err to the caller; ?? / ?. for Option.
Use case: print(...)
Section titled “Use case: print(...)”// fragment-onlyprint("counter=", c.n)print("opt=", unwrap_or(Some(5), 0), unwrap_or(none_i, 7))Call form with parentheses (console.log-style). Bare print x still works. Ambient — no Caps grant.