[erlang-questions] Self referencing records.
Ludovic Coquelle
lcoquelle@REDACTED
Wed Jul 18 06:28:32 CEST 2007
I'm not sure to understand the undelying problem, but I think there is a
problem of syntax.
Is the following what you're looking for?
test() ->
T = #object{class='Object', props=dict:new()},
NewProps = dict:append("this", T, T#object.props),
T#object{props=NewProps}.
On 7/18/07, Julio César Carrascal Urquijo (MCTS) <jcarrascal@REDACTED>
wrote:
>
> 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/
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20070718/45d50098/attachment.htm>
More information about the erlang-questions
mailing list