[ruby-core:34752] Is evaluation order of arguments specified?

2 views
Skip to first unread message

Nikolai Weibull

unread,
Jan 21, 2011, 11:30:15 AM1/21/11
to Ruby Developers
Is the evaluation order of arguments specified? I couldn’t find
anything in RubySpec in regard to this question.

Evan Phoenix

unread,
Jan 21, 2011, 12:52:44 PM1/21/11
to ruby...@ruby-lang.org
The evaluation order is left to right. If there is not a rubyspec for it, that should be fixed. There is lots of code that depends on this ordering (Rubinius for a time used a right to left ordering which broke things).

Left to right, btw, includes the receiver therefore being first and the block being last.

- Evan

Nikolai Weibull

unread,
Jan 21, 2011, 1:16:22 PM1/21/11
to ruby...@ruby-lang.org
On Fri, Jan 21, 2011 at 18:52, Evan Phoenix <ev...@fallingsnow.net> wrote:
> The evaluation order is left to right. If there is not a rubyspec for it, that should be fixed.

I have to admit that I only made a cursory glance over the RubySpec,
looking where I figured it would be, but found nothing.

> There is lots of code that depends on this ordering (Rubinius for a time used a right to left ordering which broke things).

My tests confirmed this order on MRI, but I wasn’t sure if anyone had
actually specified it as required.

Thank you for your answer!

Evan Phoenix

unread,
Jan 21, 2011, 1:21:25 PM1/21/11
to ruby...@ruby-lang.org

It's required in so far as matz has stated it's left to right on ruby-core before and ruby code depends on it. :)

Reply all
Reply to author
Forward
0 new messages