This PR adds syntactic sugar for data declarations. Now we can write them as follows:
data Maybe(t) {
None
Some [ t ]
}
Constructors can still be written in the old style, with arrows and commas:
data Maybe(t) {
None,
Some -> t,
}
In addition, I added a struct declaration, which is syntactic sugar for a single-constructor data declaration:
struct Person {
name: Str
age: Int
}
is equivalent to:
data Person {
Person [
name: Str
age: Int
]
}
The rationale behind the new data syntax is to make it look visually distinct from the new def syntax, so that it's easier to not confuse them, which was a problem with the old style.
This PR adds syntactic sugar for
data
declarations. Now we can write them as follows:Constructors can still be written in the old style, with arrows and commas:
In addition, I added a
struct
declaration, which is syntactic sugar for a single-constructordata
declaration:is equivalent to:
The rationale behind the new data syntax is to make it look visually distinct from the new
def
syntax, so that it's easier to not confuse them, which was a problem with the old style.