From: "David A. Black" Date: 2005-02-14T00:11:51+09:00 Subject: Re: evaluation order Hi -- On Sun, 13 Feb 2005, Martin DeMello wrote: > David A. Black wrote: > >> (For clarity I've deleted the warning about using '=' in conditional. >> [Matz, can't we get rid of that warning?]) > > I'd love per-warning suppressibility, but if not, I think this particular > one does more good than harm. (But then, I find the if (a = f(x)) idiom > rather ugly to begin with). I'm trying to figure out the pattern behind when it gets triggered or not: irb(main):002:0> while (x = 1); end (irb):2: warning: found = in conditional, should be == irb(main):003:0> while (line = gets); end abc ^D => nil irb(main):004:0> if (m = /a/.match("b")); end => nil irb(main):005:0> if (m = /a/); end (irb):5: warning: found = in conditional, should be == irb(main):006:0> if (m = "abc".replace("abc")); end => nil irb(main):007:0> if (m = "abc"); end (irb):7: warning: found = in conditional, should be == => nil When the rhs is a literal, I guess? That at least vastly increases the chances of its being a case of a typo. Could it be that Matz is several steps ahead of me? :-) David -- David A. Black dblack@wobblini.net