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

Re: Hiding specials, and namerefs



On Thu, Jul 23, 2026 at 7:12 PM Philippe Altherr
<philippe.altherr@xxxxxxxxx> wrote:
>
> I was reviewing the code of typeset_single in order to understand how special parameters get localized. I still haven't figured this out but I noticed that this condition is most likely missing a PM_NAMEREF.

    else if (usepm || newspecial != NS_NONE) {
    int chflags = ((off & pm->node.flags) | (on & ~pm->node.flags)) &
        (PM_INTEGER|PM_EFLOAT|PM_FFLOAT|PM_HASHED|
         PM_ARRAY|PM_TIED|PM_AUTOLOAD);
    /* keep the parameter if just switching between floating types */

Adding PM_NAMEREF there changes only the "remove nameref attribute"
and "add and remove readonly attribute with references" tests in K01
(and not in I think a way we want) and makes no difference to `typeset
-gn SRANDOM`

E.g.:
--- expected
+++ actual
@@ -1 +1 @@
-typeset ptr=var
+typeset ptr
Test K01nameref.ztst failed: output differs from expected as shown above for:
 typeset -n ptr=var
 typeset +n ptr
 typeset -p ptr
Was testing: remove nameref attribute




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