Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

syntax nits #828

Open
johnynek opened this issue Dec 28, 2021 · 2 comments
Open

syntax nits #828

johnynek opened this issue Dec 28, 2021 · 2 comments

Comments

@johnynek
Copy link
Owner

This is a list of syntax issues that seem irregular or confusing and should be possibly changed.

@johnynek
Copy link
Owner Author

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)

@johnynek
Copy link
Owner Author

now that currying has been removed, this makes more sense. #1026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant