[erlang-questions] Records referring to each other

ANTHONY MOLINARO anthonym@REDACTED
Tue Jul 8 20:41:21 CEST 2014


Hi,

I came across it when trying to compile some generated test code in the thrift code base.  The record definition looks like this,

-ifndef(_recursive_types_included).
-define(_recursive_types_included, yeah).

%% struct coRec

-record(coRec, {other :: #coRec2{}}).

%% struct coRec2

-record(coRec2, {other :: #coRec{}}).

-endif.

This returns the error

test/recursive_types.hrl:16: record coRec2 undefined

I’m wondering if there is any way to get this to work and include the types, or whether I should modify the generation to not include record types?

Thanks,

-Anthony


More information about the erlang-questions mailing list