DIP58: ".." as a Binary Operator
Mason McGill
mmcgill at caltech.edu
Mon Mar 17 13:47:05 PDT 2014
> It's a nice proposal, but what happens if you want a range of
> floats, e.g., 1.0..2.0?
Correct me if I'm wrong, parsing would look like:
----------------------------------------
1.0..2.0
=== Found a literal.
1.0..2.0
== Found a binary operator.
1.0..2.0
=== Found a literal.
----------------------------------------
Something like `5....5` could also compile (since there's only 1
valid parsing), though such a thing is clearly an abomination, so
I'd write it `5. .. .5` or `(5.)..(.5)`. The whole ordeal is
probably a bit of insight into why other languages use the ':'
character for slicing.
More information about the Digitalmars-d
mailing list