zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Daniel Shahaf <d.s@daniel.shahaf.name>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: [PATCH 3/3] Documentation for named references
Date: Tue, 7 Feb 2023 08:53:17 -0800	[thread overview]
Message-ID: <CAH+w=7ZBjhMVmLk=Rgf6PSF91nd_5OSoW=o068Rg4r4F39poJA@mail.gmail.com> (raw)
In-Reply-To: <20230207105105.GB14216@tarpaulin.shahaf.local2>

On Tue, Feb 7, 2023 at 2:52 AM Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
>
> Bart Schaefer wrote on Mon, Feb 06, 2023 at 19:25:03 -0800:
> > On Mon, Feb 6, 2023 at 4:57 PM Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> > >
> > > Bart Schaefer wrote on Sun, Feb 05, 2023 at 18:26:50 -0800:
> >
> > > > +When both a named reference and the `tt((P))' flag appear, the named
> > > > +reference is resolved before `tt((P))' is applied.
> > >
> > > Add a test for this last sentence?
> >
> > I can't think of a way to do so.  Given ${(P)ptr}, there are two possibilities:
> > 1) ptr is a scalar, in which case we're not testing the right thing
> > 2) ptr is a reference, so any other order of expansion is meaningless
> >
>
> I'm not sure I follow what would be "meaningless" here.

${(P)name} is defined to expand $name and then treat the string value
as a further parameter name.  What would it mean to expand a named
reference without resolving it?  Just ignore that it's a named
reference and treat it as a scalar?

(Skipping suggested test cases, I'll add them just for completeness)

> > If ptr is a reference, a working test of ${ptr} implies that ${(P)ptr}
> > also works. [...]
>
> That doesn't seem to be the case in the following:
>
> % ary=( 'bry[1]' 'bry[2]' )
> % bry=( lorem ipsum )
> % typeset -n nr='ary[2]'
> % echo $nr
> bry[2]
> % echo ${(P)nr}
> zsh: bad substitution

That doesn't have to do specifically with (P), it's the same error as this:

> % ary=( foo bar )
> % typeset -n nr='ary[2]'
> % echo ${nr}
> zsh: bad substitution

That'll have to be looked at.

> > > s/Local Parameters/Named References/
> >
> > Thanks, thought I'd caught all of those ... it was nice when the older
> > version of yodl complained about those incorrect references.
>
> The yodl macro is a thin wrapper around the texinfo macro.  Perhaps
> texinfo warns about this somewhere in its output?

I'm grumbling about the wrong thing, it's actually "makeinfo" that
used to complain but doesn't in newer versions of texinfo.


  reply	other threads:[~2023-02-07 16:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-06  2:26 Bart Schaefer
2023-02-07  0:56 ` Daniel Shahaf
2023-02-07  3:25   ` Bart Schaefer
2023-02-07 10:51     ` Daniel Shahaf
2023-02-07 16:53       ` Bart Schaefer [this message]
2023-02-08 21:28         ` 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='CAH+w=7ZBjhMVmLk=Rgf6PSF91nd_5OSoW=o068Rg4r4F39poJA@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=d.s@daniel.shahaf.name \
    --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).