From: Robert Dober Date: 2007-07-19T05:53:02+09:00 Subject: Re: The Pebble in the Ruby Shoe On 7/18/07, dblack@wobblini.net wrote: > Hi -- > > On Thu, 19 Jul 2007, Robert Dober wrote: > > > On 7/18/07, MenTaLguY wrote: > >> On Wed, 2007-07-18 at 22:56 +0900, Robert Dober wrote: > >> > > Lets not forget also that doing things for the sake of being different > >> help no > >> > > one. I for one must work in multiple languages. I still haven't > >> forgiven Matz > >> > > for the whole, "0 is true" thing. ;-) > >> > That is the single best feature of Ruby once you got used to it -- > >> > with "" is true!!! > >> > >> One of the biggest advantages to this is that it makes || and ||= > > and one of its biggest dangers too, I wonder how much time has been > > spent in looking for "Why has my already (with false) initialized > > variable been overwritten?" > > I am *not asking* that false evaluates to true, but I suggest that > > > > x=false > > x||=42 > > x --> false > > But x ||= 1 is really: x = x || 1. David I know that but it could be x= 1 if x.nil? Actually I think this might better reflect the common use cases, but not be consistent (I said it again, sorry) with &&=, += etc, and that probably would hurt too much. And for that reason I was thinking about x ??= 42. That was the idea, sorry if I am not clear at all today :( > So you'd end up with, > essentially, false || 1 being false, which wouldn't make sense, and > sort of would be false evaluating to true :-) Why not, just kidding:) Robert -- I always knew that one day Smalltalk would replace Java. I just didn't know it would be called Ruby -- Kent Beck