From: itsme213 Date: 2005-01-06T17:51:30+09:00 Subject: Re: Ruby design question: lazy construction of object graph containing forward references "itsme213" wrote in message news:kl5Dd.1593$ho.126@fe2.texas.rr.com... > 1) x = OpenStruct.new > 2) y = OpenStruct.new(:f0 => x, :f1=>x.forward_ref) > 3) z = [x, y, x.forward_ref] > 4) w = y.f1 > 5) foo(y.f1) > 6) bar(y.f1.f2) > 7) x.forward_ref = Object.new > > I want to build such structures lazily, but be lazy only when the laziness > is needed i.e. not for :f0=>x, or [x, y, ...], or y.f1. Oops, typo: should have been "..., or [x, y, ...], but lazy for y.f1".