[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Comments on changesyntax et al.
From: |
Eric Blake |
Subject: |
Re: Comments on changesyntax et al. |
Date: |
Sat, 10 Feb 2007 23:22:27 +0000 |
Hi Daniel,
> I just recently discovered m4's progress toward version 2.0. There's a
> *lot* to like in the feature list, and I'm glad to see the project isn't
> stuck in maintenance mode.
Thanks for the feedback! There's still a lot to do before 2.0; I'm on
a two-week vacation at the moment with only email access, then
when I return, I hope to release M4 1.4.9 and a beta snapshot of 1.9b.
2.0 has to wait until libtool 2.0 is released, since it depends on
libtool features not available in the current 1.5.x series.
>
> The new changesyntax() builtin is very enticing. I noticed that in (CVS)
> m4/examples/WWW/m4lib/ there is even a LaTeX-like Web design macro language
> already elaborated.
Glad you like it!
>
> instead of the more LaTeX-like
>
> \macro{arg one}{arg two}{arg three}
>
> which is what I want, not least because it all but does away with the need
> to quote the arguments.
Nice idea, but how best to encode that into what changesyntax can do?
>
> Open paren => "(["
> Close paren => ")]"
>
> ...m4 won't recognize (let alone enforce) proper nesting; "foo(bar]" would
> be a valid macro call. I don't see how a set-of-characters match is
> well-suited for defining these sorts of syntax categories.
Any suggestions on improving this as well?
>
>
> On a different note, may I make a feature suggestion/request? I see that
> two of the syntax categories address "extended argument references." These,
> from what I can tell, work the same way as standard argument references,
> except for the extra bit of syntax protection---you can say e.g.
> "1111${2}1111" safely.
Work in progress. Very much in progress. The goal is to obey POSIX
by treating $10 as the first argument concatenated with 0 (rather than
the 1.4.x behavior of treating it as the tenth argument), then to use
the POSIX out that ${ is an implementation-defined sequence to
treat ${1} as the first argument, just as it is in /bin/sh. But since this
syntax makes shell output awkward, Paul Eggert convinced me
to add changeextarg(<start>,<end>), allowing a multiple-character
sequence as the delimiters of extended arguments, if desired.
Therefore, autoconf 3.0 will likely choose ${{1}} as the m4 first
argument, leaving ${1} as literal shell output. But for now, all I've
done is implement cingle-character delimiters that aren't even
parsed, other than a syntax category is reserved for them.
Help would be welcome. If you plan on making large patches,
you will need to assign copyright to the FSF.
>
> But that wasn't obvious to me at first, and for a moment I was thinking m4
> had gained support for named arguments. Which would have been a really,
> really nice feature to have. Something where you could do e.g.
>
> => define(`foo', `The ${noun} is ${verb}.')
> => foo(noun = `fox', verb = `running')
> The fox is running.
You're not the first to have this idea. But with extended arguments,
we may have a cleaner syntax. The only problem I see right now
is that if I release M4 1.4.9 as is, you would have to wait until
M4 2.1 for this feature, since Paul convinced me that for purposes
of a transition period, only ${<digit> should be recognized as
the start of an extended argument. On the other hand, that was
before we came up with the idea for multi-character extended
argument delimiters, so maybe I should just reserve ALL ${
sequences in the default warning of M4 1.4.9's --warn-macro-sequence.
Like I said, it will be a couple of weeks before I have any more M4
hacking time, but I appreciate your feedback on the work in progress.
--
Eric Blake