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

Re: named references

On Jun 28, 12:07pm, Andrej Borsenkow wrote:
} Subject: RE: named references
} This does not touch everything (I need some time to swallow the rest :-)
} What happens in this case:
} foo() {
}   typeset -n r=v
}   local v=foo
}   echo $r
} }
} v=bar
} foo
} I.e. does r refer to outer v ("by address" could you say) or to inner
} v ("by name" would it be then)? The latter would be badly broken; but
} to implement the former you must have reference to pm not the name.

You actually don't need the reference, you just need both the name and the

Oliver's partial implementation got this right, by stashing the target
local-level in the reference's `ct' field, and then after looking up the
parameter by name, searching its `old' linked list for the right `level'.
But using a pointer directly to the pm is a lot faster.

Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   

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