From: Rick DeNatale Date: 2006-10-13T23:42:13+09:00 Subject: Re: Ruby expressions vs. values (like Perl?) On 10/12/06, AlexG wrote: > Someone with better understanding of Ruby internals will need to > confirm this because I may well be wrong, but I think you are correct. > eval.c creates a temporary array out of the right-hand side (in the > svalue_to_mrhs function I think). Page 91 of the Pickaxe (2nd Ed) > explains this a little more. Whether or not optimising the Array away > is possible or desirable is another question. Unless you are doing some > pretty insane parallel assignment I wouldn't have thought it makes any > practical difference. Yep, that's exactly what seems to be happening. One reason for this is so that a parallel assignment like x, y = y, x works correctly. If the interpreter simply broke that down into series of assignments without the temporary array, then it would need to detect such cases and handle them separately or: x = 1 y = 2 # x, y = y, x # converted into x = y y = x x => 2 y => 2 which is not what we want. -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/ IPMS/USA Region 12 Coordinator http://ipmsr12.denhaven2.com/ Visit the Project Mercury Wiki Site http://www.mercuryspacecraft.com/