Proposal: takeFront and takeBack

monarch_dodra monarch_dodra at gmail.com
Wed Jul 4 00:40:54 PDT 2012


On Wednesday, 4 July 2012 at 04:33:14 UTC, Jonathan M Davis wrote:
> Okay, given the fact that takeFront wouldn't work with ranges 
> like
> std.stdio.ByLine, the code as proposed won't work. So, here's 
> an adjusted
> proposal:
>
> https://github.com/jmdavis/phobos/commit/14b88d9d5528f8736ae6014013bba82367e83620
>
> As suggested, I renamed takeFront and takeBack to consumeFront 
> and consumeBack
> respectively, but now they're in std.array and only apply to 
> arrays.
>
> ...
>
> If no one has any major objections to this scheme or can 
> provide a better
> proposal, I'll create a pull request from what I have.
>
> - Jonathan M Davis

I like the new scheme.

I'm not 100% sold on the name "consumeFront" though. For 
starters, it introduces a notion of "consumption", which does not 
exist anywhere else in the language.

Furthermore, "consume" is a bit loaded, some of its usages 
carries negative connotations. It is sometimes used as "over 
indulging" when eating. "to consume" by itself usually means to 
do drugs. consume can also mean "destruction by fire", and the 
word carries loaded meaning in cultures like the Indian Culture, 
where the dead are ritualistically burned (consumed) in open fire.

I know it is just a minor detail, and probably culture oriented, 
but naming is the kind of thing you chose in 1 days, and then 
have to maintain for 3 decades. If "take" wasn't even called 
"take" to begin with (it doesn't even _take_ anything...), we 
wouldn't be having this discussion. If we are looking for a new 
name, I think it is worth the effort to brainstorm on it.

I'll propose "spendFront", which is pretty much the same thing, 
but is less loaded. I'm not entirely sure if it carries the 
meaning as well? I think it is a worth discussion.

----



More information about the Digitalmars-d mailing list