Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: array prepend
- X-seq: zsh-workers 30962
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: array prepend
- Date: Sun, 13 Jan 2013 17:50:23 -0800
- In-reply-to: <20130113185141.4394d532@pws-pc.ntlworld.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <50EFB80D.30002@sergio.spb.ru> <22417.1357954693@thecus.kiddle.eu> <20130113185141.4394d532@pws-pc.ntlworld.com>
[redirected to -workers]
On Jan 13, 6:51pm, Peter Stephenson wrote:
} Subject: Re: array prepend
}
} On Sat, 12 Jan 2013 02:38:13 +0100
} Oliver Kiddle <okiddle@xxxxxxxxxxx> wrote:
} > If you dig out the mailing list discussion from when += was added
} > you'll see that the main reason there isn't a prepend is that we
} > couldn't think of suitable syntax that would be backward compatible.
}
} I was thinking about /=. I started looking at it once but got bored
} with all the varieties of parameter type.
Hrm, I'm not exactly excited by that choice, /= implies some sort of
division rather than union.
} > -= for example
} > isn't possible because a - character is valid in an identifier.
Thinking again, I'm not sure that's the reason. There doesn't seem to
be any syntactic reason to exclude -= (it doesn't parse now); rather,
=+ doesn't work because a + character is valid in the parameter value,
but I think -= was rejected on the same implied-semantics grounds that
I just raised for /=.
What about a special case for empty brackets? VAR[] is not currently
a valid identifier even though e.g. VAR[*] is.
VAR[]=(this is prepended)
VAR[]+=(this is appended)
VAR+=(short for 'VAR[]+=')
Messages sorted by:
Reverse Date,
Date,
Thread,
Author