From: Robert Klemme Date: 2007-09-04T22:37:26+09:00 Subject: Re: assigning to hash keys when there is a default value? 2007/9/4, Yossef Mendelssohn : > 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? That an assignment of x=x is useless (basically a nop in the standard case of x being a variable). Please see also one of my earlier postings. Kind regards robert