Hi,

In message "Re: open-uri patch, added progress_proc hook"
    on 03/11/24, Mathieu Bouchard <matju / sympatico.ca> writes:

|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
|
|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.

I'm not going to abandon "real" closure.

  def foo(n)
    (0...n).map {
      local {|a|
        a = 0
        lambda{a+=1; a}
      }
    }
  end

You will just need to ask it explicitly.

							matz.