Hex float literals (alternative syntax)

Prior discussion: issue 1306, issue 1433, earlier pre-RFC.

All else being equal, it seems to me the smallest possible change from the C syntax is desirable, and it looks like the earlier pre-RFC proposes just that:

[the problem with the C syntax 0xFF.Fp1] is there is an ambiguity between a hex float literal and a field and/or method off of an integer.
...
[A straightforward solution] is to require the + or - sign in the exponent. 0xFF.Fp+1 is completely unambiguous: since integers have no fields, it will always be rejected by the typechecker, regardless of its context. As such, it is 100% backwards compatible (except to the writers of syntax extensions) to make 0xFF.Fp-1 a single lexeme.

I'm tempted to just send a PR.

2 Likes