On 05/17/2014 01:46 PM, Daniel Goldman wrote: > Eric, > >> We intentionally want a minimal set of builtins, and leave the >> bulk of the power in wrappers around the builtins. > > Thanks for responding. Of course it's a good point to limit the number > of builtins. Related to that, is there a reason why incr and decr are > builtin macros, when it seems likely they could work as composites, or > just use eval directly?
Historical practice. POSIX standardized them because not providing them would break m4 scripts that are now over 40 years old. > >> Yes, and that's why the autoconf language has an m4_ifndef wrapper >> alongside the m4_ifdef wrapper. But that didn't require a new builtin. >> > > Of course, I never suggested a new builtin was required. As I mentioned, > I had seen references to ifndef, so I already divined that it existed. > The problem was my searches found zero documentation. I'm sure it's > there, but it's at least somewhat hidden. All I found was very > specialized autoconf macros. Is there a link you (or someone else) could > send to autoconf ifndef documentation, along with other general (not > specialized) macros used by autoconf? Autoconf documentation (note that autoconf uses changequote([,]), rather than the default `'): https://www.gnu.org/software/autoconf/manual/autoconf.html#Programming-in-M4sugar Autoconf implementation (not for the faint of heart - there are some really convoluted macros in there, such as m4_expand) http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=blob;f=lib/m4sugar/m4sugar.m4 > Finally, the m4 manual has some 25 composite macros. Most of them seem > pretty useful. But it's certainly not a comprehensive list (eg, ifndef > is not included). Besides the manual, is there any other collection of > general purpose m4 composite macros? Autoconf, sendmail, and bison all use m4 for various purposes, and each has developed their own library of macros they found useful. But as for a general-purpose library of m4 composite macros, I don't really know of anything designed for that purpose. But we could certainly document an m4_ifndef macro in the M4 manual, since it would be a useful teaching tool. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature