[Prev][Next][Index][Thread]

Re: Closures



> Yes.  The following snippet demonstrates this (I hope...):
> 
> def closure
>   val = 0
>   return proc {
>     val += 1
>     val
>   }
> end

To fully demonstate it, you need to return two procedures and show
that assignment to val in one also affects the other.

Otherwise the semantics might be "copy bindings" rather than "share
bindings".

-- Jeff