"Consume", "Skip", "Eat", "Munch", "Bite", or...?
Philippe Sigaud
philippe.sigaud at gmail.com
Sun Feb 21 05:17:28 PST 2010
On Sat, Feb 20, 2010 at 21:48, Andrei Alexandrescu <
SeeWebsiteForEmail at erdani.org> wrote:
> To focus the discussion about naming conventions, let's discuss one
> particular aspect. Right now we have in std.algorithm:
>
(snip)
> 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
Would using policies be a solution?
enum ModificationPolicy { doesNotModify, Modifies};
That way, you can keep the same name throughout the module.
And the same for eager or lazy versions of some algorithms. Map/Filter could
be eager rather than lazy (though I like them lazy) and return an array.
Would that be possible, with well-thought defaults?
Philippe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20100221/fa77de10/attachment.html>
More information about the Digitalmars-d
mailing list