Meta-Erlang (was RE: Erlang vs Java revisited)
Wed Sep 28 19:10:37 CEST 2005
----- Original Message -----
From: "Ulf Wiger (AL/EAB)" <>
> One of the annoying things about parse transforms is that
> you tend to have to cover the entire language even if you
> just want to add a small tweak.
Yes, I know, I tried it myself.
That's why I think that it would be interesting to explore how it would work
to be able to embed this into the language proper (or more precisely, its
Example, a simple parse transform could look like this (just a rough
ParseTransform = meta:define(
fun(F, A) ->
io:format("start fun ~p(~p)", [P, A]),
Result = apply(meta:splice(F), meta:splice(A)),
io:format("returns ~p", [Result]),
meta:define() returns the abstract code for the argument
meta:splice() inserts the arguments' value in the current abstract code
Then by defining
this parse transform would be applied in the compiled code.
Much simpler, right?
More information about the erlang-questions