zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-workers@zsh.org
Subject: Re: Subscript flag (i) not working correctly on empty strings?
Date: Sun, 08 Jan 2023 19:47:32 +0000	[thread overview]
Message-ID: <f6e69a4d6d84fa672aa1b64633040bd7297a7337.camel@ntlworld.com> (raw)
In-Reply-To: <CAH+w=7Z5=ncO6JXa=qhbXkXkpC_3V5gBSv4eCv=ASXjYmT1zVA@mail.gmail.com>

On Fri, 2023-01-06 at 10:12 -0800, Bart Schaefer wrote:
> On Fri, Jan 6, 2023 at 9:24 AM Peter Stephenson
> <p.w.stephenson@ntlworld.com> wrote:
> > 
> > > On 06/01/2023 16:01 Philippe Altherr <philippe.altherr@gmail.com> wrote:
> > > 
> > > > s=; echo $s[(i)z];
> > > > 0
> > > 
> > > Why is the last line 0 and not 1?
> > 
> > Certainly looks plain wrong.
> > None of the existing tests fail with this change.
> 
> I thought there was a discussion about this at some point in the past
> ... but it may have been limited to array cases.  I have the feeling
> we concluded that (i) and (I) should produce the same result on empty
> string for purposes of boolean tests, but I can't find such a
> conversation in the archives.

Can you think of any piece of shell code that might rely on this,
in the absence of any historical corpus?  As far as I can see
this is a plain misuse of (i), which isn't there for boolean tests.

This doesn't feel to me like a big issue anyway and in the absence of a
clear cut reason I would think consistency should triumph.

pws



      parent reply	other threads:[~2023-01-08 19:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-06 16:01 Philippe Altherr
2023-01-06 17:23 ` Peter Stephenson
2023-01-06 18:12   ` Bart Schaefer
2023-01-07 13:45     ` Philippe Altherr
2023-01-07 13:52       ` Roman Perepelitsa
2023-01-07 13:54         ` Roman Perepelitsa
2023-01-08 19:47     ` Peter Stephenson [this message]

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=f6e69a4d6d84fa672aa1b64633040bd7297a7337.camel@ntlworld.com \
    --to=p.w.stephenson@ntlworld.com \
    --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).