From: "J.Herre" Date: 2004-02-21T11:12:20+09:00 Subject: Re: PATCH: OpenStruct#initialize to yield self On Feb 20, 2004, at 5:59 PM, Joel VanderWerf wrote: > J.Herre wrote: >> On Feb 20, 2004, at 4:33 PM, Joel VanderWerf wrote: >>>> | record = OpenStruct.new do |r| >>>> | r.name = "John Smith" >>>> | r.age = 70 >>>> | r.pension = 300 >>>> | end >>>> How much benefit do you get from this than >>>> r = OpenStruct.new >>>> r.name = "John Smith" >>>> r.age = 70 >>>> r.pension = 300 >>>> ? Bit of readability? >>> >>> >>> Someone mentioned before that it lets you construct an object that >>> can be GC-ed as soon as initialize is done. FWIW. >>> >> Neither of these cases would gc until the local went out of scope or >> was cleared? What am I missing? > > That's true. The point is that in the former case, r goes out of scope > when the block is done. Yeah but 'record' still points to the struct just as 'r' What's the point of? | OpenStruct.new do |r| | r.name = �John Smith� | r.age = 70 | r.pension = 300 | end ie, constructing an orphaned obj