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

Re: PATCH: Explain array append a bit better

Mikael Magnusson wrote:
> Should we perhaps mention array prepending somewhere too? I read the
> sections "Array Subscripts" and "Array Element Assignment", and
> searched for the string 1,0 and came up with nothing.

I think that was left undocumented intentionally in the first place. I
could be wrong but, in the code, it looks like behaviour that fell out
of the implementation rather than something that was designed in. It
isn't exactly nice and I wouldn't ever use it in scripts. Interactively,
I have an abbreviation for it that I rarely use but also have aliases
like: alias -- +fpath='fpath=( ~+ $fpath)'

I don't really have an opinion either way on whether we should document
it now. I'd prefer to see some other syntax introduced. When we last
discussed prepending (30962), []= was the best suggestion we had
but needs to touch the current subscript code so is trickier to to
implement. -= ^= and /= were rejected before.

Another option that occurs to me now is
  +var=( ... )


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