[erlang-questions] Re: implementing annotation in erlang

John Hughes john.hughes@REDACTED
Thu Sep 10 08:54:18 CEST 2009


I usually add the line numbers automatically anyway--build generated code 
without them, then traverse it and insert the same line number into each 
node. It's easy to do and it helps a bit.

John

From: "paweł kamiński" <kamiseq@REDACTED>

finally I went through parse_transform but constructing even simple format
from scratch is a nightmare.

to prepare something like
cmdCallbackList()->
[{"cmdDevSetTime",setTime,1},{"cmdFpSetStatus",setStatus,2}].

I need to build
{function,19,cmdCallbackList,0,
     [{clause,19,[],[],
          [{cons,20,
               {tuple,20,
                   [{atom,20,"cmdDevSetTime"},
                    {atom,20,setTime},
                    {integer,20,1}]},
               {cons,20,
                   {tuple,20,
                       [{atom,20,"cmdFpSetStatus"},
                        {atom,20,setStatus},
                        {integer,20,2}]},
                   {nil,20}}}]}]}

is there a way to construct code blocks in more elegant way, something like
create_fun(LineNo, Name, Arity, Body, ..)-> would produce function block
create_tuple(LineNo, Tuple)
create_list(...)
and so on




More information about the erlang-questions mailing list