1.9 mode: block arguments incorrect, differs from MRI (& spec?)
---------------------------------------------------------------
Key: JRUBY-4665
URL: http://jira.codehaus.org/browse/JRUBY-4665
Project: JRuby
Issue Type: Bug
Components: Interpreter
Affects Versions: JRuby 1.4, JRuby 1.3, JRuby 1.5
Reporter: Gergely Nagy
Priority: Minor
It seems like JRuby's --1.9 mode block argument checking is not according to
the MRI, and would possibly be non-standard.
http://eigenclass.org/hiki/Changes+in+Ruby+1.9#l45.
Problem #1:
-----------
Empty block argument lists should mean '||' , and JRuby should complain if
arguments passed when calling the block/proc:
jruby --1.9 -e 'lambda {|| p "I am broken"}.call(:param)' # says it's
broken, instead of ArgumentError
Interestingly, this works in 1.8 mode:
jruby -e 'lambda {|| p "broken"}.call(:param)' #
ArgumentError as expected
Tried with a few MRI versions, they do the same: ArgumentError.
Problem #2:
-----------
Missing block argument lists in 1.9 should mean '||', so it should behave as
above.
What it does is more like the old approach (no checks).
jruby --1.9 -e 'lambda { p "broken"}.call(:param)' # says
'broken',rather than ArgumentError
MRI 1.9 throws the error as it should.
Note that in 1.8, missing block args should be treated as |*unused_args|, so
should not complain about call arguments.
JRuby works fine in this mode, just as MRI does:
jruby -e 'lambda { p "OK"}.call(:param)' # OK as expected
ruby1.8 -e 'lambda { p "OK"}.call(:param)' # OK as expected
It seems jruby --1.9 block is more relaxed with block arguments, although it
should be actually sticter than in 1.8.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email