Let's do front, back, popFront, and popBack!
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Fri Jan 30 06:15:50 PST 2009
bearophile wrote:
> popFront, and popBack:
>
> An alternative possibility is to have "pop" and "popFront", where "pop" removes from the back.
>
> In Python you can use pop() to remove from the back and pop(0) to remove from the front, but I presume this isn't much appreciated in D.
>
> Bye,
> bearophile
There are structures (heap, stack) that only allow pop, which would make
matters rather confusing. One nice thing about the STL is a consistent
naming convention. They have front, back, push_front, push_back,
pop_front, and pop_back when these make sense. When only one pop makes
sense, the name of the function is pop, as expected. The nice thing is
there's almost no need to explain what each of these does and why
they're called that way.
Andrei
More information about the Digitalmars-d
mailing list