From: Russell Norris Date: 2007-09-04T22:35:11+09:00 Subject: Re: assigning to hash keys when there is a default value? The problem with that is that || doesn't work that way, imo. x || whatever only does whatever if x isn't true. Excuse me if I'm sounding like abroken record but the more we talk about this the more I'm convincedthat this "bug" only exists if you expect || to act like + does justbecause it's an "operator" instead of allowing for the fact that ||isn't a method like + and friends. || is special. It takes another bus to ||= than + does, heh. ;) Sorry for the silliness there. RSL On 9/4/07, Yossef Mendelssohn wrote:> On Sep 4, 7:32 am, "Robert Klemme" wrote:> > 2007/9/4, Pe単a, Botp :> >> > > From: sco...@gmail.com [mailto:sco...@gmail.com] On Behalf Of Russell Norris:> > > # I learned that x ||= y means set x to y unless x, so I don't see the> >> > > there's the bug: you've changed the meaning of x ||= y, or of foo=bar for that matter.> >> > > # bug. and i don't see this as being at all unpredictable.> >> > > you just said you've _learned that x||=y means set x to y unless x. Surely it was _unpredictable at some point. Surely x=y is a no-brainer for a many of us :)> >> > > and now we all have to update our test cases, cause maybe x += 1 may not always be x = x + 1> >> > > speaking of least surprise :(> >> > No, "x+=1" will always be "x=x+1".> >> > robert>> If '"x+=1" will always be "x=x+1"', what's the problem in having x ||=> 1 always be x = x || 1?>> --> -yossef>>>