-
Notifications
You must be signed in to change notification settings - Fork 126
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
Interaction between fractional literals and projections #876
Comments
Humm... yeah that's annoying. I guess languages like JavaScript handle this by making field projections be identifiers. I think it would be OK to disallow space after the
|
If we're going to reimplement the lexing and parsing rules for tuple projections, we might as well take care of #713 at the same time. Instead of allowing any numeric literal to be used as a tuple projection, we should allow only a list of decimal digits. |
Something that might complicate this change a bit is that the record update syntax allows tuple selectors to appear without a preceding dot:
|
That's a good point. I think we could get this to work with a bit of hackery in the parser though. Alternatively, we could go with the more consistent but uglier version where selectors always have dots at the front... |
I should have suggested a nested tuple update like this:
(This works in the current version only if you put a space before or after the dot in |
This is the hackery I was referring to. A sequence like Let's discuss this in person during the ticket review tomorrow. |
In #875 points out that
\x -> x.2.1
gives a parse error "unexpected 2.1" while previously it used to be two projections.This is because the projection operator
.
is currently treated as its own operator, so the tokens for the body of the lambda arex
,., and
2.1`.One way to fix this would be to say that we don't allow space after the
.
for a selector, so essentially a selector is its own token, like.2
for example. With this interpretation the tokens would bex
,.2
and.2
and we'd get the old behavior.The text was updated successfully, but these errors were encountered: