[BUG] nil#call
Reported by mitchellvriley | June 16th, 2008 @ 06:03 AM | in 1.0 preview
In Rubinius, nil has a call method but in MRI it doesn't. This, for example, breaks the gem more_money, and probably more.
The problem is that when you yield in a method without a block being passed, nil#call is used to call LocalJumpError.
An example of the problem:
bar = foo.respond_to?(:call) ? foo.call : foo
This throws a LocalJumpError if foo is nil, which is not what you would expect.
Comments and changes to this ticket
-

mitchellvriley June 16th, 2008 @ 06:38 AM
- → Title changed from nil#call to [BUG] nil#call
-

-
Evan Phoenix June 16th, 2008 @ 06:35 PM
- → Assigned user changed from to Evan Phoenix
I've seen this before. Your code doesn't work on 1.9 either, which defines NilClass#call to raise a LocalJumpError as well. I've run into this a couple places and just informed the author that in future ruby version, it needs to be changed anyway and they change it.
I've only seen that occur twice, so it's pretty rare anyway it seems.
We can discuss a workaround if we think this is really common though.
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
