[erlang-questions] Record metadata

Dmitry Kolesnikov <>
Tue Mar 27 21:29:31 CEST 2012


Thanks again for hit!

I found the following solution very promising for my need, just need to hack it for record type.
http://blogtrader.net/blog/recbird_an_erlang_dynamic_record

Regards, Dmitry

On Mar 27, 2012, at 1:49 PM, Tim Watson wrote:

> You'd need the abstract code available and then you can call
> dialyzer_utils:get_record_and_type_info/1 which returns a dict
> containing the type information. You can then pass this dict to
> various functions in the erl_types module to get back information
> about type specs.
> 
> If you don't want to rely on dialyzer at runtime, you'll need to
> copy-paste the code from dialyzer_utils AFAICT. Also the erl_types
> module is part of hipe.
> 
> On 27 March 2012 07:58, dmitry kolesnikov <> wrote:
>> Hello,
>> 
>> Let say I do have a record definition:
>> -record(my, {
>>  a :: atom(),
>>  b :: binary()
>> }).
>> 
>> Are there any possibility to extract a metadata of record elements
>> during run-time? E.g call_some_magic_fun that says R#my.a is atom,
>> R#my.b is binary...
>> 
>> Thanks for any advice!
>> 
>> Best Regards,
>> Dmitry >-|-|-*>
>> _______________________________________________
>> erlang-questions mailing list
>> 
>> http://erlang.org/mailman/listinfo/erlang-questions




More information about the erlang-questions mailing list