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

Philippe Altherr <[email protected]>
Newsgroups gmane.comp.shells.zsh.devel
Message-ID <CAGdYchtYW-3yERGwQfvkKZG7jfBnS-6Y058beoHu6xY6XSZNHQ@mail.gmail.com>
>
> 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 <https://zsh.org/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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.