From: Robert Date: 2003-03-18T04:07:26+09:00 Subject: Ruby Idiom: method with/without block Hi folks, through recent offline discussions a Ruby idiom drew my attention: There are methods that belong to a pair of resource allocator and deallocator (like File#open and File#close) where the resource allocator ("open") can be used with and without a block. When used with a block, the resource deallocator ("close") must not be called, because that is done after the block exits via "ensure". Now, to me this seems like mixing different behaviors in a single method. Having methods that do different things depending on the argument list is often regarded bad OO. I'm interested to hear why this approach was taken. Was it to reduce the number of method names one needs to memorize? What do others think? Kind regards robert