bosatsu
bosatsu copied to clipboard
syntax nits
This is a list of syntax issues that seem irregular or confusing and should be possibly changed.
One thing I've noticed wrt to user defined types, we define them with parens:
struct Foo(a: Int)
and can treat them as functions or names:
f = Foo(1)
f = Foo { a: 1 }
The function application style is actually also auto currying (like all functions).
An alternate approach would be to only use the named style:
struct Foo { a: Int }
f = Foo { a: 1 }
this regularizes the syntax a bit but makes the currying style more verbose:
# original
struct Foo(a: Int, b: Int)
make_with_a1 = Foo(1)
# this is now Foo(1, 2)
f = make_with_a1(2)
# in the proposal:
struct Foo { a: Int, b: Int }
make_with_a1 = \b -> Foo { a: Int, b }
f = make_with_a1(2)
now that currying has been removed, this makes more sense. #1026