[Top][All Lists]

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

Re: AC_FOREACH public?

From: Stepan Kasal
Subject: Re: AC_FOREACH public?
Date: Thu, 20 Oct 2005 14:31:59 +0200
User-agent: Mutt/1.4.1i


On Thu, Oct 20, 2005 at 11:48:20AM +0100, Keith MARSHALL wrote:
> Oops.  Forgot that GNU's list mailers don't set the Reply-to header
> properly, (can this not be fixed?), and only replied privately to
> Stepan.

this can be easily set in mailman.  Mailman help doesn't recommand it,
pointing to:
though there is also:

I use mutt, with the config command "subscribe".  I can press "L" to send
the reply to the list, "r" to send it to the sender and "g" to send it to

[Keith, this is a copy of my previous answer with some text appended to
teh end.]

> I *like* autoconf, but, if I have one harsh criticism, it is that 
> perfectly good macro names are deprecated much too frequently.

Yes, I miss AC_TRY_COMPILE and friends.  Unfortunately, since the new
interface is (subtly) different, it was necessary to find another name.

If a macro has nothing to do with Autoconf, it is just a feature
of the macro language, then it should be named m4_*
This is the case of m4_include, m4_if, m4_define and such.

And this is the case of AC_FOREACH; if you write

AC_FOREACH([Boy], [Saul Fred Orrie], [Hi, Boy!

you get

Hi, Saul!
Hi, Fred!
Hi, Orrie!

this is just a macro feature.  It has nothing to do with shell scripting
nor with "configure script generation".

So AC_FOREACH is not a good name.  But, of course, that is not reason to
touch it.  But:

> If the previous AC_FOREACH implementation is flawed, then by all means
> reimplement it the way this silly thing does, but keep the elegant name

But what if the interface is broken?  There is no way to add

        Hi, Paul, my dear!

to the above loop--the string contains spaces.  m4_foreach is much better:

m4_foreach([Boy], [Saul, Fred, Orrie], [Hi, Boy!
m4_foreach([Boy], [[Saul], [Fred], [Orrie], [Paul, my dear]], [Hi, Boy!

The first call is equivalent to the previous example.  The second one is
fully quoted and shows that members can contain spaces and commas.

So I believe that in most cases it is better to use m4_foreach instead
of AC_FOREACH.  Actually, in a private discussion Ralf admitted that
a comma separated list (so called "m4 list") might be better for his

So I'm more and more convinced that the "Foreach" node in Autoconf manual
should first describe m4_foreach and recommend it.

Then it would document m4_split and say: "If, for some reason, you have
to process a whitespace-separated list, you can use this pattern:
       m4_foreach([Var], m4_split(m4_normalize([$1]), [...Var...])
supposing that $1 contains the list.

m4_normalize has to be documented, too, perhaps in another section,
say "text manipulation".  The m4_bpatsubst could go there, too.
(It's not a redefined builtin, so there is no reason why it should
be in "Redefined M4 Macros".)

[ I asked Ralf to write this piece of documentation, if he finds time,
but if any of you is willing to help with this, I think he won't mind. ]

Have a nice day,
        Stepan Kasal

reply via email to

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