zsh-workers
 help / color / mirror / code / Atom feed
From: Clint Adams <clint@zsh.org>
To: zsh-workers@sunsite.dk
Cc: 163391-forwarded@bugs.debian.org
Subject: [doogie@debian.org: Bug#163391: unset array[key] where key is non-existent doesn't fail]
Date: Sat, 5 Oct 2002 13:31:25 -0400	[thread overview]
Message-ID: <20021005173125.GA24695@dman.com> (raw)

I'm not sure to what "contract" he's referring, but SUSv3 says

  Unsetting a variable or function that was not previously set shall not
  be considered an error and does not cause the shell to abort.

and that unset should return a >0 exit status if any of the "name"
operands cannot be unset.

Of course, it knows nothing about associative arrays.

----- Forwarded message from Adam Heath <doogie@debian.org> -----

bash-2.05b$ zsh -c 'unset non_existant_var && echo error || echo
correct; unset "array[1]" && echo error || echo correct; declare -A
aarray; unset "aarray[foo]" && echo error || echo correct'
correct
correct
error

The contract for unset says that if the variable being unset doesn't exist, an
error is returned.  As shown above, variables and normal arrays behave as
expected, but associative arrays do not.

----- End forwarded message -----


             reply	other threads:[~2002-10-05 17:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-05 17:31 Clint Adams [this message]
2002-10-05 19:52 ` Bart Schaefer

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=20021005173125.GA24695@dman.com \
    --to=clint@zsh.org \
    --cc=163391-forwarded@bugs.debian.org \
    --cc=zsh-workers@sunsite.dk \
    /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).