Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: unshift





On 2024-04-01 09:20, Roman Perepelitsa wrote:
It doesn't seem super useful to be honest. The semantics are odd, too.
What should this do?

    shift
    set blah
    unshift

Or this?

    foo=(42)
    shift foo
    integer foo
    unshift

There is no obvious answer, only options with pros and cons. The path
from a special-purpose hack to a general solution is long and arduous.

Sure, that's what I expected to here.  Come to that, I've never used shift for anything other than the positionals which is all I'm considering, but if there was an unshift it would obviously have to be globally useful not, as you say, some single use hack.  And since the hack is easy, your way or Stephane's, the functionality is already there.









Messages sorted by: Reverse Date, Date, Thread, Author