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

Re: [PATCH 1/3]: Add named references



On Sat, Feb 11, 2023 at 3:43 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> On Fri, Feb 10, 2023 at 11:45 PM Bart Schaefer
> <schaefer@xxxxxxxxxxxxxxxx> wrote:
> >
> > On Fri, Feb 10, 2023 at 11:02 PM Oliver Kiddle <opk@xxxxxxx> wrote:
> > >
> > > fine with the reference becoming unset at the time of the return if it
> > > refers to a variable that is going out of scope.
>
> That's actually a little startling given dynamic scoping.  It leads to this:
>
> {
>   typeset -n ref=var
>   () {
>     var=FUNC1

# that should of course be "local var=FUNC1" sorry

>     typeset -p ref
>   }
>   typeset -p ref
> }
>
> Output:
> typeset -g -n ref=var
> typeset: no such variable: ref




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