On Sun, May 18, 2025 at 10:11 PM Eric Blake <ebl...@redhat.com> wrote:
>
> On Sun, May 18, 2025 at 07:52:56AM -0400, Nikolaos Chatzikonstantinou wrote:
> > >
> > I fixed this with 0225f85. I got argument collection wrong twice, but
> > the second time I was much further from the truth. At the time your
> > example len((1, 2)) threw me off. I didn't realize I was just trimming
> > whitespace too aggressively, and I wrote a bad patch for it that had
> > special treatment of '(' when in argument collection. Your comment
> > example with (( and )) also helped me discover that I had an
> > "off-by-one" error in comment parsing (I had forgotten to include the
> > final delimiter).
>
> There's still an issue with argument collection where you are
> accidentally expanding a $@ that only exists as a result of whatever
> gets substituted into $1 and so on (tested at commit 852a0f):
>
> $ m4
> define(b,`.$1$2.')dnl
> b($,1)
> .$1.
> b($,@)
> .$@.
> $ m4p
> define(b,`.$1$2.')dnl
> b($,1)
> .$1.
> b($,@)
> .$,@.

Good catch. The info manual mentions arguments like $10 to mean the
10th argument will be phased out of GNU m4. Should I still emulate
that or should I keep the single-digit-only expansion?

Regards,
Nikolaos Chatzikonstantinou

Reply via email to