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

Re: [PATCH 1/3]: Add named references



On Fri, Feb 10, 2023 at 7:04 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> > > It might deprive us of many clever tricks but parse_subscript() could
> > > gain a flag to disable anything questionable like command substitution
> > > and math evaluation side-effects.

I'm not sure what to do about math side-effects, but I've hit upon the
idea of expanding subscripts that appear in named references with
EXECOPT set to zero (noexec).  That reduces $(...) to the empty
string, except for the special-case $(<file) that is being discussed
in another thread.

Switching to noexec around singsub() in getarg() is quite easy, and as
previously mentioned you can still do fully dynamic subscripts with
${(P)...}.




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