planet-erlang

Dynamic variables hack in Erlang

One thing that jumps to the eye in functional code sources is longer-than-usual argument lists.


process(Tree, Env, Plugins, Config, ...).

It's easy to see that as a consequence of functions using arguments as sole input channel. (Global -define()'s don't qualify as input channels—they can't vary at runtime, arguments can.)

Usually it's no big hassle.

Literal XML in Erlang with parse_transform/2

One of the things I dislike about Erlang is that it severely impairs bragging opportunities. Yesterday I wrote a module that allows writing literal XML in the source and have it parsed into Erlang structures at compile time—sort of like E4X minus the manipulation goodies at runtime (at least for now).

You write:


Doc = '<greeting>Hello!</greeting>',
io:format("~p~n", [Doc]).

And it prints…

Syndicate content