"Consume", "Skip", "Eat", "Munch", "Bite", or...?
Jonathan M Davis
jmdavisProg at gmail.com
Sat Feb 20 16:06:06 PST 2010
- Previous message: "Consume", "Skip", "Eat", "Munch", "Bite", or...?
- Next message: "Consume", "Skip", "Eat", "Munch", "Bite", or...?
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Andrei Alexandrescu wrote:
> I also defined recently:
>
> =======================
> /**
> If $(D startsWith(r1, r2)), consume the corresponding elements off $(D
> r1) and return $(D true). Otherwise, leave $(D r1) unchanged and
> return $(D false).
> */
> bool startsWithConsume(R1, R2)(ref R1 r1, R2 r2);
> =======================
>
> There are a few other functions like that: one version takes a range by
> value, the other takes it by reference and alters it.
>
> The question is, what is a good naming convention for expressing that?
> Other examples: findConsume, consumeFind.
>
>
> Andrei
I thought that that was basically what chompPrefix did, and chompPrefix
seems like a great name to me, but I guess that that's not entirely
generalizable: chompFind or findChomp would be a bit weird. Consume seems
like the best of the ones that you suggested. It is explicitly what you're
doing. It's a bit long, but the others aren't as clear. Other suggestions
might be erase or remove, since you appear to be erasing/removing elements
from the range. Consume is probably better though.
- Jonathan M Davis
P.S. You could also go for startsWithFineDiningWithAFourCourseMeal. People
would absolutely love _that_ function name. ;)
- Previous message: "Consume", "Skip", "Eat", "Munch", "Bite", or...?
- Next message: "Consume", "Skip", "Eat", "Munch", "Bite", or...?
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Digitalmars-d
mailing list