Re: more m4p bugs

Nikolaos Chatzikonstantinou <[email protected]> Sun, 18 May 2025 23:31:19 -0400
Newsgroups gmane.comp.gnu.m4.general
Message-ID <CAAQmekdB2DRUcksp-BMh0=2TbTFbcB+qLSX=h7d-KE398i8ZRA@mail.gmail.com>
On Sun, May 18, 2025 at 10:11=E2=80=AFPM Eric Blake <[email protected]> wro=
te:
>
> On Sun, May 18, 2025 at 07:52:56AM -0400, Nikolaos Chatzikonstantinou wro=
te:
> > >
> > 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