Notes on the M4 Macro Language (2008)
mbreen.com
mbreen.com
Notes on the M4 Macro Language (2008) - https://news.ycombinator.com/item?id=22757645 - April 2020 (59 comments)
Related:
M4 as a templating language (2020) - https://news.ycombinator.com/item?id=27994092 - July 2021 (112 comments)
M4 (computer language) - https://news.ycombinator.com/item?id=17781062 - Aug 2018 (26 comments)
Ask HN: Do you use M4 in production? - https://news.ycombinator.com/item?id=15870100 - Dec 2017 (1 comment)
M4BASIC – A BASIC to C converter written in M4 - https://news.ycombinator.com/item?id=10748131 - Dec 2015 (1 comment)
I use it as a low-brain template engine to do only that.
Before YAML or Dockerfiles, it was the way to declare state and reduce complexity for sysadmins. Basically, any time you had data that needed multiple projections (eg. hosts to forward and reverse zonefiles), you reached for m4. The same went for unwieldy configs (apache, sendmail, etc.).
Culturally, macro languages seem to be just learned ad-hoc, ie. how many here have had a class in m4 or TeX?
I haven't, but could be interested; are there any good tutorials or such that you might suggest?
For an abstract, design/implementation introduction, though? There isn't. We don't learn about macro languages just as we don't learn about domain specific languages.
(Or maybe you're looking for something totally different; I'm not aware of anything that uses literate programming to feed hints back into an editor, although I'm sure someone has made emacs do it, probably using org mode;])