C<unshift>'s only virtue, IMHO, is that it's clearly the inverse of
C<shift>.  But I think the spelling and aural relationship between
C<push>, C<pop>, C<pull>, and C<put> is clear enough to negate that.

But then, I'm a little biased.

Except that push and pull are logical opposites linguistically, but not in standard CS parlance. could be very confusing.

There's a possibility of using C<enq> and C<deq> for enqueue/dequeue, except that C<deq> == C<pop> in standard implementations.

So C<enq> and C<shift>? yeck.

If there's a willingness to rename shift/unshift, why not consider going a bit further (and offend shell heritage) to note that pull/put aren't really linguistically opposed either (unlike push/pull). Why not rename pop to pull, and use something like put/take for shift/unshift? Having push and pull operate on opposite ends of an array strikes me as more confusing than even shift. When it comes to adding and removing elements, shouldn't there be semantic opposition for functions that operate on the same end?


 (I realize that take is already ... taken, for control structures.)



Reply via email to