On Dec 23, 2004, at 11:57 PM, Matt Maycock wrote:

> My use of SimpleDelegator is that I don't want a case like this:
> handle = nil
> input_reader("myfile") {|handle| ...}
> some_func(handle)

Thank you for walking through this with me.

> granted, the file ensures that things are closed off so I really don't
> have to, but to go along with the idea of how things `should be' - I
> used simple delegator for __set_obj__.  Just design philosophy.
>
> The only case I can think of for this mattering in the file I gave is 
> this:
>
> handle = nil
> input_reader(some_arg) {|handle| ...}
> handle.puts "Meow Mix Please Deliver"

Hmm, but the code I saw was:

>   block = Proc.new {|source|
>     getter = SimpleDelegator.new(source)
>     yield getter
>     getter.__setobj__(nil)
>   }

You're worried that "getter" may have existed outside input_reader(), 
in the calling code, and you want it to be immediately obvious if you 
trample that value?

James Edward Gray II