[erlang-questions] Generating a variable in a macro

Ulf Wiger <>
Tue Jan 9 13:30:24 CET 2007


Den 2007-01-09 12:56:15 skrev Joel Reymont <>:

> I thought of that but there's record_info which is compile-time.

I made a small parse transform that allows you to easily
work around this problem:

http://forum.trapexit.org/viewtopic.php?t=6385&sid=697cc32b3303ea35a8396c19cbb50438

Adding the two lines:
-compile({parse_transform, exprecs}).
-export_records([r1,r2]).  %insert your own record names

You get exported functions for creating,
modifying and inspecting the given records.

BR,
Ulf W

>
> On Jan 9, 2007, at 11:50 AM, Mats Cronqvist wrote:
>
>> Joel Reymont wrote:
>>> Any workarounds apart from passing the  error variable as a macro
>>> argument?
>>
>>   turn make_shared_table/3 into a function?
>>
>>   mats
>
> --
> http://wagerlabs.com/
>
>
>
>
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions



-- 
Ulf Wiger




More information about the erlang-questions mailing list