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

Use different delimiters for type args and variants #42

Open
osa1 opened this issue Jan 5, 2025 · 0 comments
Open

Use different delimiters for type args and variants #42

osa1 opened this issue Jan 5, 2025 · 0 comments
Labels

Comments

@osa1
Copy link
Member

osa1 commented Jan 5, 2025

Currently we use brackets for both type arguments and variants, which cause nested brackets. From the tests in tests/Rows3.fir:

fn f2[r](): Result[[E1, E2, ..r], ()] = ...

fn f6[errs](f: Fn(): Result[[E1, ..errs], ()]): Result[[..errs], ()] = ...

Using angle brackets for one (probably type params, as that's more common so users will be familiar with it) makes sense, but we need to use a different syntax, or maybe just methods, for left and right shifts, to avoid the lexing and syntax highlighting issues with >> and <<s.

If we use angle brackets for type parameters:

fn f2<r>(): Result<[E1, E2, ..r], ()> = ...

fn f6<errs>(f: Fn(): Result<[E1, ..errs], ()>): Result<[..errs], ()> = ...

If we use angle brackets for variants:

fn f2[r](): Result[<E1, E2, ..r>, ()] = ...

fn f6[errs](f: Fn(): Result[<E1, ..errs>, ()]): Result[<..errs>, ()] = ...

Using braces is not an option, as we'll use braces for indentation insensitive syntax.

@osa1 osa1 added the syntax label Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant