From: Matt Maycock Date: 2004-12-24T14:57:54+09:00 Subject: Re: SimpleDelegate (was Re: Inconsistency with IO.readlines) So I glanced at delegate in the past but never really used it. Today, I saw this, and rewrote some old code thinking that using that would be easier (this was after I decided to post but before clicking submit [obviously :-)] - so you guys got my cutting edge changes! really just cleaned out 6 or so lines...) My use of SimpleDelegator is that I don't want a case like this: handle = nil input_reader("myfile") {|handle| ...} some_func(handle) 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" depending on the value of some_arg (nil or '-' vs otherwise) - the above code works as expected. This is especially important if you factored your code such that inside {|handle| ...} all you did was invoke a method and pass handle to it. Now, you have a `bug' and it doesn't event really look like anything remotely inputy-outputy except for my function name. So the guarantee of failure under any arguments (ie purity in a sort of functional sense) is the benefit wrt the handle.puts line, above. I may have babbled there a bit - it's late. Matthew Maycock -- There's no word in the English language for what you do to the thing a dead thing delegated to chase after you to make it stop chasing you.