On Mon, Nov 24, 2003 at 05:32:09AM +0900, Mathieu Bouchard wrote:
> I think the actual problem would be more with code that does things like
> this:
> 
> def foo(n)
>   (0...n).map {
>     proc {a=0; proc{a+=1;a}}[]
>   }
> end

This would work with the new rules (and the current ones), I believe:

def foo(n)
  (0...n).map { proc {|a| proc{ a += 1; a } }[0] }
end

> I expect this code to produce n distinct counters that will each produce
> their own independent sequence 1,2,3,4,5,... when called repeatedly. If it
> becomes impossible to do this anymore, then I won't be able to honestly
> say that Ruby really supports closures.

It won't be impossible, just inconvenient.

-- 
 _           _                             
| |__   __ _| |_ ___ _ __ ___   __ _ _ __  
| '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ 
| |_) | (_| | |_\__ \ | | | | | (_| | | | |
|_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_|
	Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com

How do I type "for i in *.dvi do xdvi $i done" in a GUI?
	-- Discussion in comp.os.linux.misc on the intuitiveness of interfaces