between and among: worth Phobosization?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Dec 16 14:11:25 PST 2013


On 12/16/13 1:47 PM, Brad Anderson wrote:
> On Monday, 16 December 2013 at 20:38:52 UTC, Andrei Alexandrescu wrote:
>> bool between(T, U1, U2)(T v, U1 lo, U2 hi)
>> {
>>     return v >= lo && v <= hi;
>> }
>>
>
> I must say that:
>
>      if (val.between(3, 10))
>
> sure is a lot easier to understand at a glance than:
>
>      if (val >= 3 && val <= 10)
>
> Although there is a problem with the word "between" not being clear
> about whether it is inclusive or not.

Prior art: SQL.


Andrei



More information about the Digitalmars-d mailing list