From: Peter Szinek Date: 2006-12-20T17:46:36+09:00 Subject: Re: ruby gotchas Luciano Ramalho wrote: > On 12/19/06, Peter Szinek wrote: >> foo = false >> bar = true >> >> baz = foo or bar >> >> baz ends up false (because = has greater priority than or) > > That sucks. You can't generalize to everybody just because it sucks for you :) Why would anyone want = to be evaluated before anything else? The question is not why would anyone want this (btw why not? btw2 this is exactly what happened here: = was evaluated before or) - but rather 'why it is more logical for someone that the rvalue is computed first then passed to the lvalue'. Hmm, maybe because it is so in the languages from where the OP comes from? (At least Java, just tested... i.e. this code: boolean y = false; boolean z = true; boolean x = y || z; System.err.println(x); prints 'true' (I did not write a single line of C# code yet but I guess it's the same there). Cheers, Peter __ http://www.rubyrailways.com