rubinius do not generate bytecode for this case
Reported by femto | May 21st, 2008 @ 09:50 PM | in 1.0 preview
def foo(a,b,c=d=1)
p [a,b,c,d]
end
foo(1,2)
foo(1,2,3)
for this, rubinius reports an error:
Bytecode generation error:
No method 'bytecode' on an instance of NilClass. (NoMethodError)
near test.rb:2
Comments and changes to this ticket
-

Peter Burns May 24th, 2008 @ 02:37 PM
What strange syntax. Matz Ruby supports it, though I wouldn't say that it meets the principle of least surprise:
$ ruby -v
ruby 1.8.6 (2007-09-24 patchlevel 111) [universal-darwin9.0]
$ irb
irb(main):001:0> def foo(a=b=1)
irb(main):002:1> p [a,b]
irb(main):003:1> end
=> nil
irb(main):004:0> foo
[1, 1]
=> nil
irb(main):006:0> foo(2)
[2, nil]
=> nil
irb(main):008:0> foo(2,3)
ArgumentError: wrong number of arguments (2 for 1)
from (irb):8:in `foo'
from (irb):8
-

Peter Burns May 24th, 2008 @ 04:03 PM
- no changes were found...
-

-
Federico Builes May 27th, 2008 @ 06:32 PM
- → State changed from new to open
Opening and hoping that someone knows how to guard the spec correctly. Running the spec as is will print an error trace but won't throw an error that a lambda/mspec can catch, so it's not "taggable" as failing. Maybe tag by hand?
-
Federico Builes June 20th, 2008 @ 07:44 PM
The specs were pushed in 6c187da3 by Peter Burns and fixed in a subsequent check by Daniel Luz in 563ff524.
-
Ryan Davis June 23rd, 2008 @ 03:48 PM
- → State changed from open to resolved
closing since the specs were pushed... we can track from there. thanks! (also, ick!)
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 »
