3 ms·
Because I've ended up using it in almost every project I'm involved in. By all rights, m4 should not be a good tool for anything. It has no type system, no synt
by gizmo686 3y ago
Because I've ended up using it in almost every project I'm involved in. By all rights, m4 should not be a good tool for anything. It has no type system, no syntax checking, no debugger, no namespaces, no real notion of atomic literals. But, it just kind of works for a bunch of situations. Basically any text based format you have can utilize m4 as a pre-processor.
Typically it comes up during integration work, where I am dealing with various technologies from various vendors for various clients in a single project. M4 ends up being a glue language for "compiling" configuration files. Where possible I prefer to use a more proper templating engine like python mako, but those are not always a good fit.
I've also used M4 as a way of implementing DSLs, which is great as long as you are fine with your DSL inheriting all of m4's problems. I've also used it to help write bindings and other highly repetitive files.