1.2 KiB
C# Language Design Notes for Jan 10, 2018
Warning: These are raw notes, and still need to be cleaned up. Read at your own peril!
Range
A proposed position.
Endpoint types
Wouldn't it be nice to have a range type that work on any comparable? Possibly, but we're not eager to solve this right now.
We need to believe that our future selves can extend the language with some form of target typing, for instance. There's a burden on them to be able to do that without a compat break (silent semantic change), e.g.: There's a type in the future that has conversions so that it would work one way in 7.3 and a different way in the future.
We want ..(int, int)
and ..(long, long)
. We want to treat those as usual operators, so they have to allow user defined conversions of the end points. We could consider blocking off normal conversions of the operands, but that's extremely distasteful.
So decision: There's Range
(for ints) and LongRange
. The ..
operators are built-in. There's an implicit conversion one way, and an explicit the other, also both built-in.
Exclusive
Exclusive isn't really the same for int ranges (where it is notational but has same).
We probably want inclusive, but we may also want exclusive. Next time.