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

Re: List of pending patches about named references



On Tue, Feb 10, 2026 at 7:40 AM Philippe Altherr
<philippe.altherr@xxxxxxxxx> wrote:
>
> One thing to keep in mind is that removing support for named references to subscripted variables could be as simple as forbidding the definition of such named references.

Following is a quick patch to do just that.  Disentangling K01nameref
will require a bit more effort, as it appears on first glance through
the failing tests that some tests that use references also test other
situations that it might be worthwhile to keep testing.

diff --git a/Src/params.c b/Src/params.c
index 3199fd17b..0d71c7f39 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -6470,6 +6470,7 @@ valid_refname(char *val, int flags)
     ++t;
     }
     if (*t == '[') {
+#ifdef ALLOW_SUBSCRIPT_REFERENCES
     /* Another bit of isident() to emulate */
     tokenize(t = dupstring(t+1));
     while ((t = parse_subscript(t, 0, ']')) && *t++ == Outbrack) {
@@ -6482,6 +6483,9 @@ valid_refname(char *val, int flags)
         /* zwarn("%s: stuff after subscript: %s", val, t); */
         return 0;
     }
+#else
+    return 0;
+#endif
     }
     return !!t;
 }




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