Project

General

Profile

Actions

Bug #1034

closed

Ruby 1.8 evaluates block argument out of order from other arguments and receiver

Added by headius (Charles Nutter) about 15 years ago. Updated almost 11 years ago.

Status:
Closed
Target version:
-
ruby -v:
Ruby 1.8
[ruby-core:21496]

Description

=begin
In Ruby 1.9 and all alternative impls I tested, block arguments are evaluated in the order they're encountered in a call. For example:

a.foo(b, c, &d)

The expected order would be left to right, a, then b, then c, then d. But Ruby 1.8 evaluates in the order d, a, b, c. In a case like the following (somewhat contrived) this would have odd side effects:

x = 0
(x += 1; a).foo(x += 1, x += 1, &(x += 1, d))

In 1.8, the two non-block arguments would be 3, 4, while on Ruby 1.9 and other impls it would be 2, 3 as you'd expect.
=end

Actions #1

Updated by ko1 (Koichi Sasada) about 15 years ago

  • Assignee set to matz (Yukihiro Matsumoto)
  • ruby -v set to Ruby 1.8

=begin

=end

Actions #2

Updated by shyouhei (Shyouhei Urabe) over 13 years ago

  • Status changed from Open to Assigned

=begin

=end

Updated by headius (Charles Nutter) over 11 years ago

This was an artifact of 1.8's interpreter. It should be fixed (which would be hard, since iter/blockarg wraps whatever call it goes with) if 1.8 is open or closed if it is not.

Updated by kosaki (Motohiro KOSAKI) about 11 years ago

  • Description updated (diff)
  • Status changed from Assigned to Closed

1.8 is dead.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0