On 02/10/2007, 7stud -- <dolgun / excite.com> wrote:
> David A. Black wrote:
> > On Tue, 2 Oct 2007, 7stud -- wrote:
> >
> >> 7stud -- wrote:
> >>> SpringFlowers AutumnMoon wrote:
> >>>>
> >>>> why is that?
> >>
> >> Or even simpler:
> >>
> >> a = Array(1..6)
> >>
> >> a[puts "hello"] = a[puts "world"] = nil
> >
> > puts returns nil, and you can't index an array with nil.
> >
> >
>
> Yes, I know, but that isn't the point of the example.   The output
> provides the answer to the question.

My impression was that the OP knew what the evaluation order is, but
not why it is like that.

But anyway, my take on this is that

  a[0..a.size/2] = a[a.size*2/3..-1] = nil

is equivalent to:

  a.[]=(0..a.size/2, a.[]=(a.size*2/3..-1, nil))

Arguments are evaluated left to right, completely explaining the
evaluation order the OP is seeing.

Peter