zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: zsh-workers@zsh.org
Subject: Re: array prepend
Date: Mon, 14 Jan 2013 16:48:17 +0100	[thread overview]
Message-ID: <12358.1358178497@thecus.kiddle.eu> (raw)
In-Reply-To: <130113175023.ZM5855@torch.brasslantern.com>

Bart wrote:
> Hrm, I'm not exactly excited by that choice, /= implies some sort of
> division rather than union.

I was thinking of ^= (given the meaning of ^ in a regex) but that also
implies a mathematical operation. Also note that the current += does do
addition given integer variables much as i=foo is also sensitive to an
existing integer i variable.

> 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 /=.

You're right, with -= it looks for a matching command name. Digging back
in the mail archives it seems I've remembered the reasons wrongly.

> 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[]+=')

That seems reasonably logical. Would the following be possible to prepend
to an array element?
  VAR[1][]="first"

Oliver


  reply	other threads:[~2013-01-14 15:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <50EFB80D.30002@sergio.spb.ru>
     [not found] ` <22417.1357954693@thecus.kiddle.eu>
     [not found]   ` <20130113185141.4394d532@pws-pc.ntlworld.com>
2013-01-14  1:50     ` Bart Schaefer
2013-01-14 15:48       ` Oliver Kiddle [this message]
2013-01-17  5:02         ` Bart Schaefer
2013-01-14 18:36       ` Greg Klanderman
2013-01-17  5:00         ` Bart Schaefer
2013-01-17 14:52           ` Greg Klanderman
2013-01-17 15:49             ` Bart Schaefer
2013-01-19  7:53             ` Han Pingtian
2013-01-19 16:41               ` Bart Schaefer
2013-01-20 11:08                 ` Han Pingtian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=12358.1358178497@thecus.kiddle.eu \
    --to=okiddle@yahoo.co.uk \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).