Daniel Carrera daniel.carrera-at-theingots.org |Perl 6| wrote:
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:
The change to the library synopses was checked in before you posted
that, if I recall the delta correctly.
But you bring up a point: that is indeed the common idiom from Perl 5.
That brings up the following radical idea:
Have no method named shift at all. Shift etc. will be a non-member sub
brought in through
use legacy;
and designed to work just like Perl 5, for that express purpose. The P6
way of doing it would be to not do that: use iterators rather than
destructivly going through the array, or use decomposition to do things
in a more functional way, or use the more general syntax to delete one
element from the beginning, in-place or copy as indicated.
--John