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

Re: [Language Design] How should references to localized special parameters behave?



What if builtin.c typeset_single() marked the pseudo parameter as
read-only and params.c scanendscope() undid that when restoring?  (Or
an equivalent.)

Requires a little care to avoid removing PM_READONLY from a special
that is expected to carry it, but it sidesteps the whole issue.  The
home=/var assignment would be an error before it became a segmentation
fault.

That wouldn't be enough because even just expanding $home triggers the segmentation fault. For standalone special parameters, turning the hidden instance into a functional one (but with no specialness) isn't difficult. This approach is only problematic with tied special parameters. However, in my work on inline assignments (workers/55075), I found that most difficulties go away if one assumes that localizing one of the two tied parameters also localizes the other one, like unsetting one also unsets the other one. Then, when a pair of tied parameters is localized, the hidden pair can remain tied and functional (but with no specialness).

Philippe



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