[erlang-questions] Self referencing records.

Julio César Carrascal Urquijo (MCTS) <>
Wed Jul 18 06:13:47 CEST 2007


Hi,

Is it possible at all to create a record that references it self? The
following obviously doesn't work and I understand why but I'd like to
know if there's a work around.

-record(object, {class, props}).

test() ->
    T = #object{class='Object', props=dict:new()},
    T#object.props = dict:append("this", T, T#object.props),
    T.

Thanks

-- 
Julio César Carrascal Urquijo
Microsoft Certified Technology Specialist
http://jcesar.3stecnoinformatica.com/


More information about the erlang-questions mailing list