On 9/2/2012 4:40 PM, Andrei Alexandrescu wrote:
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.
Then there's no way to specify an empty interval. I suppose with "between" that
would not be relevant.
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