class X shared var _counter = 0 get counter from var def incCounter _counter += 1 def main s = Stuff(a=1, b=2) assert s.a == 1 and s.b == 2 s = Stuff('a', b='b') assert s.a == 'a' and s.b == 'b' letters = 'aoeu' s = Stuff(letters, b='b') assert s.a == letters and s.b == 'b' s = Stuff(nil, b='b') assert s.a is nil and s.b == 'b' s = Stuff(nil, b=String) assert s.a is nil and s.b is String s = Stuff(doSomething = ref .incCounter) # pass a method reference assert .counter == 0 ds = s.doSomething ds() assert .counter == 1 t = Thing(nil, data=5) # test passing nil to a strongly typed arg assert t.data == 5 s = Stuff(style=StyleType(Hype)) # test enum construction nested inside a prop set t = Thing(nil, where=5) # test a property that coincides with a keyword assert t.where == 5 enum StyleType Undefined OldFashioned Hype class Stuff var _a as dynamic? var _b as dynamic? var _style cue init .init(nil) cue init(a as dynamic?) base.init _a = a pro a from var pro b from var pro style from var sig DoSomethingSig pro doSomething from var as DoSomethingSig? class Thing var _data as dynamic? var _stuff = Stuff(a='a', b='b') # test in var decl cue init(s as Stuff?) base.init pro data from var pro where from var as int