zsh-users
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: "Lawrence Velázquez" <larryv@zsh.org>
Cc: Ray Andrews <rayandrews@eastlink.ca>, zsh-users@zsh.org
Subject: Re: uninvited members of associative array
Date: Sat, 17 Dec 2022 23:25:04 +0000	[thread overview]
Message-ID: <20221217232504.GF8411@tarpaulin.shahaf.local2> (raw)
In-Reply-To: <7a12a4c0-d423-4538-a194-18e9cf932fe9@app.fastmail.com>

Lawrence Velázquez wrote on Sat, Dec 17, 2022 at 16:07:50 -0500:
> Bart already addressed the actual issue, so I'll just touch on this:
> 
> On Sat, Dec 17, 2022, at 3:31 PM, Ray Andrews wrote:
> > I don't understand 
> > the difference between '-A' and '+A' maybe that's part of it -- the 
> > global array might not be overwritten cleanly or something.
> 
> If the array is already populated, "set +A" only replaces its leading
> elements, which means existing elements can get left behind.
> 
> 	% arr=({a..j}); typeset -p arr
> 	typeset -a arr=( a b c d e f g h i j )
> 	% set -A arr {1..5}; typeset -p arr
> 	typeset -a arr=( 1 2 3 4 5 )
> 	% set +A arr x y z; typeset -p arr
> 	typeset -a arr=( x y z 4 5 )
> 
> I'm not sure why you brought this up.  Are you using "set +A"
> somewhere?

Could someone please clarify this in the manual?  zshbuiltins(1) says
"will replace the initial elements of the array" and it's not clear that
"initial elements" doesn't mean "all elements" but only the prefix ones.

Thanks,

Daniel


  parent reply	other threads:[~2022-12-17 23:26 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-15 23:48 Ray Andrews
2022-12-16  0:05 ` Lawrence Velázquez
2022-12-16  0:48   ` Ray Andrews
2022-12-16  1:29     ` Lawrence Velázquez
2022-12-16  2:09     ` Dominik Vogt
2022-12-16  2:56       ` Ray Andrews
2022-12-16  3:21         ` Lawrence Velázquez
2022-12-16  4:16           ` Ray Andrews
2022-12-16 10:05             ` Dominik Vogt
2022-12-16 14:13               ` Ray Andrews
2022-12-16 15:19                 ` Dominik Vogt
2022-12-16 19:14                   ` Ray Andrews
2022-12-16 16:30                 ` Daniel Shahaf
2022-12-16 18:21                   ` Ray Andrews
2022-12-16 19:04                     ` Dominik Vogt
2022-12-16 20:10                       ` Ray Andrews
2022-12-16 21:15                         ` Dominik Vogt
2022-12-16 21:33                           ` Bart Schaefer
2022-12-16 21:59                             ` Dominik Vogt
2022-12-16 22:15                               ` Bart Schaefer
2022-12-16 23:33                                 ` Ray Andrews
2022-12-17 12:47                                   ` Pier Paolo Grassi
2022-12-17 17:32                                     ` Ray Andrews
2022-12-17 18:10                                 ` Ray Andrews
2022-12-17 18:19                                   ` Roman Perepelitsa
2022-12-17 20:31                                     ` Ray Andrews
2022-12-17 20:49                                       ` Bart Schaefer
2022-12-17 21:07                                       ` Lawrence Velázquez
2022-12-17 21:52                                         ` Ray Andrews
2022-12-17 22:10                                           ` Bart Schaefer
2022-12-17 23:41                                             ` Daniel Shahaf
2022-12-18  0:15                                             ` Ray Andrews
2022-12-18  0:25                                               ` Daniel Shahaf
2022-12-18  2:13                                                 ` Ray Andrews
2022-12-18 20:12                                                   ` Daniel Shahaf
2022-12-18 20:26                                                     ` Bart Schaefer
2022-12-18 20:41                                                       ` Ray Andrews
2022-12-18  3:44                                               ` Lawrence Velázquez
2022-12-17 23:25                                         ` Daniel Shahaf [this message]
2022-12-16 21:33                           ` Ray Andrews
2022-12-16 20:25                       ` Daniel Shahaf
2022-12-16 21:43                         ` Dominik Vogt
2022-12-16  3:20 ` Bart Schaefer
2022-12-16  4:15   ` Ray Andrews
2022-12-16  8:12 ` Roman Perepelitsa

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=20221217232504.GF8411@tarpaulin.shahaf.local2 \
    --to=d.s@daniel.shahaf.name \
    --cc=larryv@zsh.org \
    --cc=rayandrews@eastlink.ca \
    --cc=zsh-users@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).