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

Re: [PATCH] Named reference typos & misc.



On 14/02/2023 16:14 Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Tue, Feb 14, 2023 at 6:47 AM Peter Stephenson
> <p.w.stephenson@xxxxxxxxxxxx> wrote:
> >
> > I need the following to make the tests pass --- else no error message.
>
> I get a passed test with or without the "unsetopt typeset_to_unset".
> 
> Is there some way this could be platform-dependent?

Was wondering; this is pretty old, Ubuntu 16.04, x86_64.  I don't have
anything bang up to date but I've got some alternatives I can try.

Here's a minimal case:

zsh -fc 'setopt typeset_to_unset
setopt warn_nested_var
unset one
typeset -n ref
() {
  typeset one=ONE
  for ref in one; do
    : ${ref}
  done
}'

No error message; sticking an "un" at the start makes it appear.

I kept the loop in the function to avoid a (correct) additional warning
message setting the global variable ref in the loop.  I don't know if
setting ref in a for loop should actually elide that message, which
is a completely separate issue.

pws




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