handful and interval

Jonathan M Davis jmdavisProg at gmx.com
Mon Sep 3 11:12:02 PDT 2012


On Monday, September 03, 2012 19:52:26 David Nadlinger wrote:
> 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.

I agree. If it's purely a matter of aesthetics, then I see no reason to add 
anything like handful. There needs to be a practical reason for it.

- Jonathan M Davis


More information about the Digitalmars-d mailing list