method call argument and receiver eval order
Reported by Ryan Davis | February 22nd, 2008 @ 05:06 PM | in 1.0 preview
Comments and changes to this ticket
-
Ryan Davis February 29th, 2008 @ 07:08 PM
- → State changed from new to open
-
Ryan Davis March 10th, 2008 @ 06:50 PM
- → Title changed from talk to wilson about masgn stuff for activesupport to method call argument eval order
- → Assigned user changed from Ryan Davis to Evan Phoenix
(was: talk to wilson about masgn stuff for activesupport)
-

Juha Pohjalainen July 15th, 2008 @ 05:10 PM
- → Title changed from method call argument eval order to method call argument and receiver eval order
- → Tag changed from to compatibility compiler spec
Both receiver and arguments are evaluated from right to left (and not left to right as MRI or JRuby does).
I've (tried to) attached a spec which runs in MRI and JRuby, and not in Rubinius.
I think code that causes this is located at Compiler::Call#bytecode (in file lib/compiler/bytecode.rb).
Bytecode there is generated at following order:
- emit_args (in reverse order, which causes arguments to be evaluated in reverse order)
- @block.bytecode
- receiver_bytecode evaluated last
That generates "correct" bytecode and unfortunately that does not work correctly. It is totally different thing to generate working code with correct evaluation order.
I also suspect that there are (bytecode) specs which are wrong, since they are assuming that generated bytecode is correct, but it evaluates things in wrong order.
I think this is major one, since it affect what parameters applications receive. So is anybody working on this? Or have ideas how to fix it?
-
Evan Phoenix July 15th, 2008 @ 05:14 PM
This can not be fixed with the shotgun, the current VM, as it requires the right to left ordering.
This is fix in the C++ VM though. Once it's merged in, this can be closed.
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 »
