From: Mathieu Bouchard Date: 2003-11-24T03:12:29+09:00 Subject: Re: open-uri patch, added progress_proc hook On Wed, 19 Nov 2003, T. Onoma wrote: > Tanaka Akira: > > pbar = nil > > open("http://...", > > :content_length_proc => lambda {|s| > > (pbar = ProgressBar.new("test", s)).file_transfer_mode if s > > }, > > :progress_proc => lambda {|s| > > pbar.set s if pbar > > }) > > In Ruby2, `pbar = nil' can be dropped. > > yes, it seems almost bizarre that pbar is kept "on hand" by both > lambdas. this is closure right? wow! this could have big effects on > Ruby1 code running with Ruby2. I'm puzzled by how this new behaviour would make anything actually easier for anyone, while demanding significant workarounds for code that relies on having separate locals for multiple activations of a closure. Unless I'm really missing something big (please tell me!), it seems to be about on the same level as my proposed merging of Module and Class, except that my proposal didn't have such an obvious compatibility impact. > p.s. if you don't mind me asking, what do you think of Structural > Reflection? never heard about it, though the words do sound familiar. what is it? ________________________________________________________________ Mathieu Bouchard http://artengine.ca/matju