From: Phrogz Date: 2006-10-06T22:50:11+09:00 Subject: Re: Compound Parallel Operators Martin Coxall wrote: > > Wouldn't it be nice if all compound operators worked with parallel > > assignment? > > a,b,c *= x,y,z > > would thus be interpreted as > > a *= x > > b *= y > > c *= z > > That's a scary bit of perlish implicitness. They call it "Do What I > Mean", when actually it's "Attempt to Do What You Think I Mean Getting > it Right 60% of The Time". Where do you draw the line? By that rationale, Isn't "a *= b" or "a,b = x,y" DWIM? I would say DWIM only becomes a problem when the interpretation of a particular syntax varies based on the context. In this case (and a*=b and a,b=x,y) the language has one and only one clear interpretation. Now, I would consider it a valid argument to say "Let's not codify a particular interpetation of some syntax that conflicts with another reasonable interpretation, because it will be surprising to a notable percentage of programmers." Would anyone say that they personally have a different expectation for what "a,b += x,y" might mean? > You know, time taken to type out expressions is not the limiting > factor in a programmer's efficiency. No, but it certainly contributes. I don't write 'block'-based functions in JavaScript because it is prohibitively annoying to type an anonymous function: myArray.each( function( a ){ alert( a ) } ); I'm not going to say that terser is always better, but one of Ruby's strong suits is its ability to succinctly express what you mean. Death by a thousand paper cuts is still death, and every little bit of polish helps. IMO.