m4 all the things

I've been solving problems with m4 lately:

For quick DSL's, m4 is great. The DSL looks like simple function calls, and is much more succinct than the same DSL in Ruby (the favorite language for DSL's today). It also ships on every *nix, no need for a special runtime, or packages for that runtime (with all the versioning/dependency issues that come with it).

Oh, there are downsides:

I'm whipping up a static blog generator for this blog, which is why it's low on features right now. I think there's a case for always authoring this way, even if I want to move back to a dynamic blog engine (e.g. WordPress and friends). That case is portability. It will be trivial to add an m4 script later which transforms my blog posts into SQL 'upsert' statements instead of static pages. I'll always be able to migrate the blog easily to any platform.

I can think of a few other uses:

...and I'm sure you can think of others.

6/24/2013 by stasibear Permalink
m4 dsl meta