From: "F. Senault" Date: 2007-10-03T03:25:06+09:00 Subject: Re: a = b = c order of evaluation weird Le 02 octobre � 18:23, 7stud -- a �crit : > Arlen Christian Mart Cuss wrote: >> On Tue, 2007-10-02 at 23:25 +0900, 7stud -- wrote: >>> Since your example only has one subscript >>> expression, it doesn't shed any light on that issue. >> >> It demonstrates, at least, that one subscript op is evaluated >> left-to-right, thus we expect all of them to be so. > > How do you know the subscript expression wasn't evaluated from right to > left? You can play with set_trace_func : 20:16 fred@vodka:~/ruby> cat toto.rb #! /usr/local/bin/ruby a = Array(1..100) set_trace_func proc { |e,f,l,i,b,c| printf "%8s %s:%-2d %10s %8s\n",e,f,l,i,c if e == 'c-call' } a[0..a.size/2] \ = \ a[a.size*2/3..-1] \ = \ nil 20:16 fred@vodka:~/ruby> ruby toto.rb c-call toto.rb:9 size Array c-call toto.rb:9 / Fixnum c-call toto.rb:11 size Array c-call toto.rb:11 * Fixnum c-call toto.rb:11 / Fixnum c-call toto.rb:12 []= Array c-call toto.rb:10 []= Array (I didn't expect the real line numbers, by the way. Cooool !) Fred -- Now that I think about it, having a (dense) group of Marketeers and Salesweasels play russian roulette with, say, an 88 Flak would be better than handing one of them an M1911 and convincing them that their odds are better than with a revolver. (Matt Olson in ATSR)