handful and interval

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun Sep 2 23:34:33 PDT 2012


On 9/3/12 8:31 AM, Andrei Alexandrescu wrote:
> On 9/3/12 8:28 AM, Jacob Carlborg wrote:
>> On 2012-09-02 17:29, Dmitry Olshansky wrote:
>>
>>> I wouldn't question utility but rather the implementation of the above.
>>> One thing I'd love to see is thing like
>>> handful!("struct", "class", "union")
>>>
>>> that does pre-process contents at compile time to speed up search.
>>> In other words it's possible to not only come close to a series of a ==
>>> "struct" || a == "class" || a == "union" but surpass it.
>>
>> Sounds like an enhanced tuple?
>
> Tuple is the representation of an interval but that's where commonality
> stops.

Rats, sorry (no coffee yet). It was about "handful" and I was at 
"interval". I can see how an inclusion for tuple would make sense, even 
in the current notion - i.e. we could add "in" to Tuple and get to write:

if (x in tuple("struct", "class", "union")) { ... }


Andrei




More information about the Digitalmars-d mailing list