4 ms·
> Java/C++/python/m4 One of these things is not like the other. :) I'd love to learn why you included m4 in that list.
by bruckie 3y ago
> Java/C++/python/m4
One of these things is not like the other. :) I'd love to learn why you included m4 in that list.
- wlesieutre 3y agoIt’s the best size of machine screw
- gizmo686 3y agoBecause 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.
- Karrot_Kream 3y agoM4 seems to fit that niche in between gluing strings together and full blown Python string templating that works in a surprising amount of situations. I use it a lot, especially when templating config files in containers.