handful and interval

David Nadlinger see at klickverbot.at
Mon Sep 3 10:52:26 PDT 2012


On Monday, 3 September 2012 at 15:10:46 UTC, ixid wrote:
>>if (a in handful("struct", "class", "union"))
>>
>>How is this different from
>>
>>if(canFind(["struct", "class", "union"], a) {...}
>
> It's a lot cleaner without the mess of brackets.

I find the difference between »a in handful("struct", "class", 
"union")« and »["struct", "class", "union"].canFind(a)« to be 
largely a matter of taste – to me, the former introduces too 
much of a special case just to for a slightly nicer-looking 
syntax, whereas the other doesn't look bad either and reuses 
existing constructs.

David


More information about the Digitalmars-d mailing list