Damian Conway wrote:
In fact, I would even be happy with requiring @a.=push and @a.=shift, if
it meant that there were *no* special cases. One extra character is a
small price to pay for perfect SWIM (and not just "Say What I Mean",
the real benefit is the other SWIM: "See What I Meant").


I don't like @a.=shift. It looks like @a = @a.shift, which is of course not what you mean.

In addition, the current @a.shift is useful because it returns the element that was removed from the array, so you can do something with it:

loop {
        @customers.push @c if (@c = new_customers());
        serve_customer(@customers.shift);
}

I'm sure the more experienced people can suggest a better example.

Daniel.

Reply via email to