-
Notifications
You must be signed in to change notification settings - Fork 39
Open
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed
Description
Syntax
- Special-case
{}to mean an empty object (currently, one has to usenew Object) - Parsing this currently fails:
foo(1, 2)
Mutability/Immutability
- Make arrays and object literals immutable by default (using
Object.freeze) - Allow
mutmodifier on array and object literals
This will remove the{}footgun (it resolves toruntime.Unit, which is currently not frozen!). For a fresh mutable records, users will need to writemut {}. - Make class ctors use
Object.freezeby default – this will probably require generating getters/setters formut vals
Bugs
- Currently,
&&and||are not short-cirtuiting!
Code-gen improvements
-
Should avoid generating very repetitive "else throw match error" structures
Example
data class Foo(a) :sjs case Foo(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]
FlandiaYingmanFlandiaYingmanFlandiaYingman
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed