Critique of the M4 Macro Language

 

Language Summary

    M4 is a little known yet quite useful macro language that is available on nearly every UNIX distribution. The language accepts input from standard input and sends it to standard output. When M4 encounters a macro, the macro is expanded in place and evaluated. A macro can be defined by the user or it can be one of several predefined macros. Comments are allowed in M4. However, if the user uses the '#' character to designate a comment line, that line will still be sent to standard output. The alternative is using 'dnl' at the start of a comment line. This prevents the comment from being sent to standard output.
    A common problem in M4 is unwanted macro expansion. Suppose there is a macro named 'hello', but the user wants to send the string 'hello' to standard output.  To solve this, the user can enclose the text with single quotes or invoke M4 with the -P option. However, the -P option only prevents collisions between built-in macros and other text. User defined macros may still pose a problem.
 

Technical Content

    The technical portion of the paper is well done and well written.  The author starts the reader out with M4's special arguments and its use of command line arguments. I love how the author took the time to differentiate between '$@' and '$#'. This level of examination shows me that the author really studied and contemplated this language, examining all the fine points.
    He then writes about M4's raison d'être: macro expansion. I like how the author again takes the time to explain the problem of and solution to macro expansion. The reader then realizes that M4's greatest flaw may be the thought the user must put into making sure macro's are only expanded at the right moment.

Evaluation Criteria

    The evaluation criteria used by the author were fair and well developed. He criticizes M4 for its confusing method of quoting. Also, the reading and writing M4 decreases as the complexity of the program increases. And the lack of looping mechanisms and built-in verification features sends chills up my spine. A loop can be forced into M4 with a macro (demonstrated in the author's example program), but this is a poor and confusing method of looping, as the author correctly points out.

Writing Style

    I read the paper several times and found no glaring errors. Spelling , grammar, syntax, and semantics are correct and consistent throughout the paper.  More importantly, I thought the paper flowed quite easily from one topic to another.

Conclusion

    As you can tell, I an quite pleased with this paper. I didn't think I would ever find a macro language interesting, but M4 is just that. I wish the author would have addressed some other problems of M4. For instance, when will M4 be able to handle wide characters? How about embedded Perl? Given that this language is best at text substitution, embedding Perl seems like a natural thing to do. How about to named files? Or appending output to existing files? I understand that each of those problems is a paper in itself, so I don't condemn the author for not exploring them in detail. Overall, I give this paper a 5 out of 5.  I enjoyed both the paper and the language itself.

Bibliography