From: William James Date: 2006-12-24T05:35:11+09:00 Subject: Re: Help with a ruby idiom M. Edward (Ed) Borasky wrote: > dblack@wobblini.net wrote: > > Hi -- > > > > On Sun, 24 Dec 2006, Devin Mullins wrote: > > > >> dblack@wobblini.net wrote: > >>> It is indeed functionally equivalent to those, though all of them > >>> would blow up :-) > >> Not all of them. > >> a = b unless a > >> works, for the same reason you described > >> a = a || b > >> working. Here, the "a =" is parsed before the "unless a" is evaluated. > > > > Whoops, right; thanks. > > > > > > David > > > Might I be a curmudgeon on this Christmas eve eve? I say that any idiom > that's confusing enough that its semantics isn't *instantly* > recognizable to an old FORTRAN programmer like my curmudgeonly self > probably doesn't contribute to code readability. :) So I would write > this out in "longhand" and not let the parser have an opportunity to > confuse me. So my "idiom" would be > > if (!a) then > a = b > end > > Or, since my curmudgeonly self has managed to learn Perl, :) > > a = b if !a a = b unless a