From: Marc-Andre Lafortune Date: 2011-12-12T09:36:27+09:00 Subject: [ruby-core:41598] Re: [ruby-trunk - Bug #5746][Open] Proc#curry too strict about lambda's arity. Hi, On Sun, Dec 11, 2011 at 4:06 PM, Yukihiro Matsumoto wrote: > Hi, > > In message "Re: [ruby-core:41594] [ruby-trunk - Bug #5746][Open] Proc#curry too strict about lambda's arity." > � �on Mon, 12 Dec 2011 02:08:08 +0900, Marc-Andre Lafortune writes: > > |Currently, Proc#curry raises an error when you attempt to curry a lambda with optional (but limited) arguments: > | > | � �l = ->(arg = 42) {} > | � �l.curry(1) # => ArgumentError: wrong number of arguments (1 for 0) > > In my opinion, #curry should not rely on #arity at all. �Even after > proposed fix, it accepts l.curry(3) which is wrong. I'm glad you agree that this is also another bug (although much less severe... it simply fails the fail-early principle, but at least it doesn't fail for no good reason, like this bug). > �It should use > more reliable information such as #parameters. Or my suggested arity_max. I had already prepared a bug report this morning, which I'll post now, and I'll post a proposed fix when I get a chance...