handful and interval

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun Sep 2 16:40:53 PDT 2012


On 9/2/12 10:24 PM, Walter Bright wrote:
> On 9/2/2012 7:45 AM, Andrei Alexandrescu wrote:
>> On 9/2/12 4:22 PM, Andrei Alexandrescu wrote:
>> [snip]
>>
>> The alternative would be to simply define these as functions:
>>
>> if (a.among("struct", "class", "union")) { ... }
>> if (b.between(1, 100)) { ... }
>
> Is between inclusive or not of the endpoints?

After quite a bit of thought, I think inclusive is the right way. There 
are two reasons:

1. Ranges that end in e.g. float.max or int.max would not be expressible 
if bounds were not included.

2. SQL defines between to include the limits, which sets a precedent.

Ranges are open to the right but I think intervals are quite different.


Andrei


More information about the Digitalmars-d mailing list