From: Daniel Nugent Date: 2006-02-23T10:14:11+09:00 Subject: Re: [ANN] lazy.rb 0.9.5 -- transparent futures! table_name = "CUSTOMERS" x = promise {table_name.dup} table_name = "MONKEYS" puts x =>"CUSTOMERS" Would avoid the problem. Though it's good to point out that you likely want to avoid changing the state of any variable that's captured by a promise closure (unless of course you plan on exploiting just that). On 2/22/06, Daniel Sheppard wrote: > You can just do > > table_name = "CUSTOMERS" > x = promise { table_name } > puts x > => "CUSTOMERS" > > though you have to then make sure that you leave that table_name > variable alone. > > table_name = "CUSTOMERS" > x = promise { table_name } > table_name = "MONKEYS" > puts x > => "MONKEYS" > > > ________________________________ > > From: Shashank Date [mailto:shanko_date@yahoo.com] > Sent: Thursday, 23 February 2006 9:15 AM > To: ruby-talk ML > Cc: mental@rydia.net > Subject: Re: [ANN] lazy.rb 0.9.5 -- transparent futures! > > > Hi, > > I have a feature request (along with a quick-hack solution). > > Please ignore if this is already done or sounds crazy. :-) > > Problem: All the promises I make, cannot have any arguments ! ! > > So something like this is what I have in mind: > > x = promise("CUSTOMERS") { |table_name| > long_running_query(table_name)} > > Admitedly, in this one-liner it does not make much sense. But if > the block had many many lines of code and referred to the block variable > at multiple places, suddenly it would be mean more to me. > > I have attached my hackish solution without really thinking all > the way thru. > Thanks, > > -- Shashank > > > MenTaLguY wrote: > I'd like to announce a new version of lazy.rb -- this one > offering > thread safety and transparent futures! > > Here's the web site, complete with gem and tarball downloads, > plus a bit > of documentation: > > http://moonbase.rydia.net/software/lazy.rb/ > > Bug reports would be very, very welcome. > > > > > ________________________________ > > Yahoo! Mail > Use Photomail > .mail.yahoo.com> to share photos without annoying attachments. > > > -- -Dan Nugent