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

rename the 'in' predicate to 'member' #244

Open
lutzhamel opened this issue Mar 25, 2023 · 1 comment
Open

rename the 'in' predicate to 'member' #244

lutzhamel opened this issue Mar 25, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@lutzhamel
Copy link
Collaborator

The in predicate clashes with the in keyword in for loops necessitating the use of excessive parens, e.g.

for (x,y) if x > y in pairlist do
   assert(x>y).
end

produces the error,

error: expected 'in' expression in for loop found 'do'.

This is due to the fact that in pairlist is interpreted as part of the conditional pattern

(x,y) if x > y in pairlist 

By removing the predicate in this ambiguity will disappear.

@lutzhamel lutzhamel added the bug Something isn't working label Mar 25, 2023
@lutzhamel lutzhamel added this to the Release 2.0.0 milestone Apr 7, 2023
@lutzhamel
Copy link
Collaborator Author

The workaround is to put the pattern expression into parentheses,

for ((x,y) if x > y) in pairlist do
   assert(x>y).
end

There is no good way to fix this because here the language is inherently ambiguous.

@lutzhamel lutzhamel removed this from the Release 2.0.1 milestone May 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant