On Tuesday, 3 July 2012 at 17:22:17 UTC, Wouter Verhelst wrote:
Jonathan M Davis <jmdavisp...@gmx.com> writes:

Couldn't you just overload popFront?

have a void popFront which throws off the first element without
returning anything, and an auto popFront which does return data.

I'd always been taught that "pop" means "read a bit and chop it off", which means that having to first read the front and then pop it off
(i.e., in two separate methods) feels rather counterintuitive to
me. That's in addition to the fact that yes, there's a performance
issue.

But hey, I've only been doing this D thing for a few weeks, so feel free
to ignore me if I'm not making any sense :-)

You can't overload by return value, so that is not possible.

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. That's the way C++ does it, and is what I've come to expect from any language.

Reply via email to