[Top][All Lists]

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

Re: 2.62 AT_SETUP limitations

From: Eric Blake
Subject: Re: 2.62 AT_SETUP limitations
Date: Tue, 22 Apr 2008 22:32:54 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20080213 Thunderbird/ Mnenhy/

Hash: SHA1

According to Joel E. Denny on 4/22/2008 6:14 PM:
|> Because AT_SETUP now uses the newly documented m4_expand macro, which in
|> turn REQUIRES balanced () because it temporarily uses
|> m4_changequote([(],[)]) to force preservation of unquoted space after
|> comma.
| With the assumption that the user has met the precondition of proper
| quoting, why is m4_expand needed in AT_SETUP?

Not all users meet proper quoting, even though we encourage it.  But more
importantly, AT_SETUP must calculate the line length of the expanded
output in order to output the 'ok' at the right column.  Most macros don't
care what their arguments expand to, since the argument expansion occurs
after the macro has completed and m4 rescans it all.  But for AT_SETUP,
the use of m4_expand allows expanding the arguments prior to the
completion of the AT_SETUP logic, at the expense that the argument must be
a balanced expansion.

|> Really, the problem is
|> that there is no way to determine whether $1 is safe to expand
| My precondition assumes it is.

And my documentation for 2.62 states that unbalanced parentheses,
regardless of [] quoting, are not safe to expand in m4_expand.  So if you
don't use the new quadrigraph, you are passing a $1 that violates the
constraints of the implementation.

| That's my suggestion as well... except the limitation is that the argument
| must expand properly quoted.  In the context of M4, this limitation seems
| more intuitive to me than parentheses balancing.

But m4_dquote eats space, which ruins line length calculation.  Unless you
know of a better way to make m4 expand an argument while preserving space,
without resorting to a changequote([(],[)]) the way m4_expand currently
does things, then I don't see how we can avoid documenting that a
quadrigraph is the only way to output unbalanced () in the few contexts
where we use m4_expand under the hood.  But I see Noah posted an attempt,
so I'll play with that to see how it fares at improving the issue.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org


reply via email to

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