monarch_dodra:

As far as I can recall, I've always been taught that pop does NOT (should not) return a value. Rationale being it makes you pay for a read/copy you may not have asked for.

I think it's also a matter of exception safety.


That's the way C++ does it, and is what I've come to expect from any language.

I expect a language to have a pop() in its collections, that returns the first item and removes it from the collection, as in Python. In D sometimes I put the front and popfront on the same line of code, because I think of them almost as a single operation :-)

Bye,
bearophile

Reply via email to