You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Special-case {} to mean an empty object (currently, one has to use new Object)
Parsing this currently fails:
foo(1,2)
Mutability/Immutability
Make arrays and object literals immutable by default (using Object.freeze)
Allow mut modifier on array and object literals
This will remove the {} footgun (it resolves to runtime.Unit, which is currently not frozen!). For a fresh mutable records, users will need to write mut {}.
Make class ctors use Object.freeze by default – this will probably require generating getters/setters for mut vals
Bugs
Currently, && and || are not short-cirtuiting!
Code-gen improvements
Should avoid generating very repetitive "else throw match error" structures
Example
data classFoo(a)
:sjs
caseFoo(Foo(Foo(x))) then x
//│ JS (unsanitized)://│ let lambda;//│ lambda = (undefined, function (caseScrut) {//│ let param0, param01, param02, x;//│ if (caseScrut instanceof Foo1.class) {//│ param0 = caseScrut.a;//│ if (param0 instanceof Foo1.class) {//│ param01 = param0.a;//│ if (param01 instanceof Foo1.class) {//│ param02 = param01.a;//│ x = param02;//│ return x//│ } else {//│ throw new globalThis.Error("match error");//│ }//│ } else {//│ throw new globalThis.Error("match error");//│ }//│ } else {//│ throw new globalThis.Error("match error");//│ }//│ });//│ lambda//│ = [function]
Syntax
{}to mean an empty object (currently, one has to usenew Object)Mutability/Immutability
Object.freeze)mutmodifier on array and object literalsThis will remove the
{}footgun (it resolves toruntime.Unit, which is currently not frozen!). For a fresh mutable records, users will need to writemut {}.Object.freezeby default – this will probably require generating getters/setters formut valsBugs
&&and||are not short-cirtuiting!Code-gen improvements
Should avoid generating very repetitive "else throw match error" structures
Example