From: mental@... Date: 2006-01-25T09:04:52+09:00 Subject: Re: LazyLoad Quoting Erik Veenstra : > > To get around that problem, you'd want to remember the > > block's result after calling it the first time (as lazy.rb > > does), rather than calling it multiple times. > > I added some things to make it thread safe (see below). One of > them was @real_object. That's what you mean, I think. Ah, okay, yeah. Disregard my last email then. That fixes the problem I mention there, too. > > You can do this with lazy.rb too: > > I've never seen lazy.rb before, but by now the packages is > already on my desktop. Needs some investigation. Well, you've basically rewritten it at this point. :) But there are some issues it covers that you still have to address... for example, what happens if the block raises an exception? Will normal code be able to distiguish exceptions raised by implicitly evaluated code at random locations from those which are expected? Also, is passing parms to the block actually useful to you? It seems like you could get anything you needed from the block's lexical environment. On the other end of things -- one issue that I've still got to address for myself in lazy.rb is threadsafety. So you've improved on mine in that respect. -mental