[erlang-questions] Record metadata

Tim Watson watson.timothy@REDACTED
Tue Mar 27 12:49:56 CEST 2012


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 <dmkolesnikov@REDACTED> 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
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions



More information about the erlang-questions mailing list