"Consume", "Skip", "Eat", "Munch", "Bite", or...?

Adam D. Ruppe destructionator at gmail.com
Sat Feb 20 17:22:48 PST 2010


On Sat, Feb 20, 2010 at 02:48:10PM -0600, Andrei Alexandrescu wrote:
> bool startsWithConsume(R1, R2)(ref R1 r1, R2 r2);

I rather like that. I didn't at first, but I tried think of alternatives
and everything came up short.

xxxxConsume() it a nice, short way of saying "if xxxx, consume xxxx". It
rather reminds me of the convenience functions in ncurses - looks weird
at first, but it is a very simple rule to learn.

Another nice thing about putting it at the end, is my editor's autocomplete
would kick right in. I type "startsWith", hit tab and see the various
modifiers. Minor thing, but I'd like it. They start exactly the same.

The more I think about it, the more I like it.




-- 
Adam D. Ruppe
http://arsdnet.net



More information about the Digitalmars-d mailing list