-
Notifications
You must be signed in to change notification settings - Fork 33
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
can't use comma operator when indexing #1337
Comments
In general, Civet is a bit more restrictive on where it allows the comma operator, to prevent certain ambiguities. We should probably document this, though it's a bit subtle exactly where it's allowed (and is still a work-in-progress). That said, we could support comma operators in I could imagine that it might be useful to define |
Another possibility could be comma operator as an extension to ranges like:
|
I believe C++ had a breaking change relatively recently that allowed multi-argument indexing, changing |
I'm only using it in code golf, so it's just an undocumented compatibility issue, especially this incompatibility doesn't bring any benefit. I think using it as an extension to map the index is quite nice. |
Another idea could be for indexing with length like Ruby's syntax, e.g. |
I added to It sounds like we have several possibilities for the meaning of
It'd be interesting to see motivating examples for any of these, either here or in Discord. I currently like the disconnected range slice, which could be generalized to fun things like |
[2][1,0]
is valid js, but does not parse as civet, I don't see this mentioned in https://civet.dev/comparison, so assuming this is a bughttps://civet.dev/playground?code=WzJdWzEsMF0%3D
The text was updated successfully, but these errors were encountered: