tuple.0.0 tokenises as [Ident("tuple"), Dot, Float("0.0")]. At present it produces an “unexpected token” error with a help message along the lines of “try parenthesizing the first index; e.g., (tuple.0).0”.
This is silly. We should just special-case float literals of the form /\d+.\d+/ and understand them sensibly—that the original one be treated as [Ident("tuple"), Dot, Int("0"), Dot, Int("0")]. It’s not as though there’s any ambiguity (that I see, anyway), and it’s much nicer to handle something automatically where there is no ambiguity and the meaning is perfectly clear, rather than producing a helpful error message.
There’s precedent for this approach to things in the handling of the && token, where the expression &&foo and the pattern &&foo are both treated as two & tokens rather than as a single && token.
tuple.0.0tokenises as [Ident("tuple"), Dot, Float("0.0")]. At present it produces an “unexpected token” error with a help message along the lines of “try parenthesizing the first index; e.g.,(tuple.0).0”.This is silly. We should just special-case float literals of the form /\d+.\d+/ and understand them sensibly—that the original one be treated as [Ident("tuple"), Dot, Int("0"), Dot, Int("0")]. It’s not as though there’s any ambiguity (that I see, anyway), and it’s much nicer to handle something automatically where there is no ambiguity and the meaning is perfectly clear, rather than producing a helpful error message.
There’s precedent for this approach to things in the handling of the
&&token, where the expression&&fooand the pattern&&fooare both treated as two&tokens rather than as a single&&token.