Skip to content

JRuby19mode behavior is different with CRuby. When Enumerator has mulltiple values for a block paramter. #264

@kachick

Description

@kachick

Are below behaviors expected in JRuby?

$VERBOSE = true

def each_foo(&block)
  return to_enum(__callee__) unless block_given?

  yield :a, 1
  block.call :b, 2, '3rd-arg'
end

each_foo do |*args|
  p args
end

enum = each_foo
p enum.next
p enum.next

CRuby

ruby 1.9.3p194 (2012-04-20) [i386-mingw32]

[:a, 1]
[:b, 2, "3rd-arg"]
[:a, 1]
[:b, 2, "3rd-arg"]

JRuby

jruby 1.7.0.preview2 (1.9.3p203) 2012-08-07 4a6bb0a on Java HotSpot(TM) Client VM 1.6.0_29-b11 [Windows 7-x86]

jruby --1.8

[:a, 1]
[:b, 2, "3rd-arg"]
[:a, 1]
warning: multiple values for a block parameter (3 for 1)
[:b, 2, "3rd-arg"]

jruby --1.9

[:a, 1]
[:b, 2, "3rd-arg"]
:a
:b

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions