trans wrote:
> On Sunday, December 4, 2011 3:02:29 PM UTC-5, NARUSE, Yui wrote:
>>
>>
>> After some consideration, I'm wondering why following code is not used.
>> There is already a method or proc object in usual use case?
>>
>> begin
>>   obj.__send__(callback, attributes)
>> rescue ArgumentError
>>   obj.__send__(callback)
>> end
>>
> 
> I avoid rescue clauses when I can because I am under the assumption that 
> they will (almost) always be less efficient then a conditional check.

As of ruby 1.9 a begin ... end block is almost no cost.  To raise an
exception is the hard part.  So the above code works efficiently as
long as that callback takes attributes arguments.