From: trans Date: 2011-12-07T00:42:47+09:00 Subject: [ruby-core:41505] Re: [ruby-trunk - Bug #5694][Open] Proc#arity doesn't take optional arguments into account. ------=_Part_6_17392398.1323186164269 Content-Type: multipart/alternative; boundary="----=_Part_7_21388250.1323186164269" ------=_Part_7_21388250.1323186164269 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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. ------=_Part_7_21388250.1323186164269 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit

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.

------=_Part_7_21388250.1323186164269-- ------=_Part_6_17392398.1323186164269--