RFC on range design for D2

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Sep 9 04:07:45 PDT 2008


Jason House wrote:
> Left and right Union and diff seem awkward. The kind of thing a rare user would look up *every* time they use it or read code with it. I will make one observation: requiring one range inside of the other leads to three logical ranges:
> • All elements "left" of the inner range
> • All elements "right" of the inner range
> • The inner range
> 
> In my mind that corresponds to "less than", "greater than", and "equal to".
> 
> Using this thought, here's how I think of the four awkward operations:
> LeftDiff: <
> LeftUnion: <=
> RightUnion: >=
> RightDiff: >
> 
> Maybe this could be done with some magic like r.range!(">=")(s)...
> 
> I hope this is clear. Long posts are tough to type on my cellphone...

Wow. I could never type as much on a cell. Thanks for the suggestion. I 
personally find it a bit cute, but interesting.

Andrei


More information about the Digitalmars-d-announce mailing list