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

Relax whitespace rules around operators #637

Open
farism opened this issue Sep 3, 2023 · 1 comment
Open

Relax whitespace rules around operators #637

farism opened this issue Sep 3, 2023 · 1 comment
Labels
discussion enhancement New feature or request language Language feature

Comments

@farism
Copy link
Contributor

farism commented Sep 3, 2023

The compiler could allow all of the following syntax

let a=2
let b = a|>Number.toString
let neq = a!=1
let eq = foo==2
let lte = a<=3
let lt = a<3
let gte = a>=1
let gt = a>1
let plus = a+1
let multiply = a*2
let divide = a/2
let mod = a%2==0
let exp = 2**3
let and = a==2&&a==2
let ortest = a==1||a==2
let true = ! false

Special consideration needs to be taken for

- because - is ambiguous with negative values
or because it the characters "or" can be used in variable names

In addition to relaxing the syntax, if there is no whitespace surrounding an operator, then whitespace should be inserted by the formatter. Not sure if that should be a separate issue.

@farism
Copy link
Contributor Author

farism commented Sep 3, 2023

Related #397

@Sija Sija added enhancement New feature or request language Language feature discussion labels Sep 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion enhancement New feature or request language Language feature
Development

No branches or pull requests

2 participants