bug-m4
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: enhancement suggestions


From: Stepan Kasal
Subject: Re: enhancement suggestions
Date: Fri, 11 Feb 2005 14:47:40 +0100
User-agent: Mutt/1.4.1i

Hi Akim and Gary,

On Thu, Feb 10, 2005 at 01:55:16PM +0100, Akim Demaille wrote:
> >>> "Stepan" == Stepan Kasal <address@hidden> writes:
>  > +  + We need a way to ask for one level of expansion; this is somewhat
>  > +    similar, but not identical, to `defn'.  For example:
>  > +       expandonce(`macro(a, b, c)')

> I'm not sure I agree with the "once".  You just apply the regular
> evaluation rules, and return the result quoted.  But if foo is defined
> to bar, and bar to baz, then eval([foo]) should definitely return [baz].

I believe this can be implemented as

        define([m4_quote], [[$1]])

the parameter is fully evaluated and then quoted.  Unless the expansion
contains an unmatched quote, everything works.

What we need is exactly the ``once'' feature.

After an irc discussion with Gary, his proposal has landed as `qindir' to
the TODO file in the CVS head.  Let me cite it:

  + Implement qindir.  Like indir, except that the result of the macro call
    is not expanded.  Because the input stack might contain a file or a
    string, it is probably best achieved by making note that the TOS input
    should be copied rather than rescanned.

      $ echo "a'b" > f
      $ m4
      define(a,z)dnl
      include(f)dnl
      z'b
      indir(`include', f)dnl
      z'b
      qindir(`include', f)dnl
      a'b
      define(b,NONO)dnl
      patsubst(qindir(`include', f), b, x)
      z'x

[Note to Gary: I slightly modified the example, and checked in to the CVS.]

On Thu, Feb 10, 2005 at 03:54:45PM +0000, Gary V. Vaughan wrote:
> Akim Demaille wrote:
> > Rather I think we should have another set of builtins.
>
> As in qregexp, qinclude, qifelse and so on?  [...]

I think Akim was not aware about the qindir proposal when he wrote this.

> > While you're at it, the new regexp
> > builtins should drop BRE dead, and use ERE too.

Well, as it doesn't look as if we were adding an alternate set of builtins,
I believe we could take this as a proposal to implement `eregexp' and
`epatsubst'.

Happy hacking,
        Stepan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]