Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH 3/3] Documentation for named references



On Tue, Feb 7, 2023 at 2:52 AM Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxxxxx> 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.




Messages sorted by: Reverse Date, Date, Thread, Author