Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail NNTP-Posting-Date: Wed, 11 Jan 2012 12:03:12 -0600 Date: Wed, 11 Jan 2012 10:03:10 -0800 From: Patricia Shanahan User-Agent: Mozilla/5.0 (Windows NT 5.2; WOW64; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-Version: 1.0 Newsgroups: comp.lang.java.programmer Subject: Re: Curious compiler warning References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Lines: 54 X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 75.11.53.36 X-Trace: sv3-7BP0NZ8OM/yw/jvsTcoUsyqTGDwOtTIMEL3fBgcqANI4kh52bFaoiHrSC0CDWdtupJ9yRTP8XTK/LOq!FQApVHRL+eio2HKrGf7Z+Si7F6OQedXVWMgZUnrh39VIoi+Z+Dz2ELiaU+wng04eNlR7Ymqi29u3!C/60gpNdikfQ/wmWAmvlMiBIUKmuVwzj5Dw1SyN3vog= X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 3542 Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:11232 On 1/11/2012 6:58 AM, Lew wrote: ... > "Readability" is such a subjective term. Someone who knows C, C++, C#, > Java or certain other languages might find 'x[i++] = y[j++]" perfectly > readable. Someone not familiar with these programming languages might not. I am familiar with C and C++. In the case of C, I've led a compiler implementation project. I fully understand that expression. It seems less obvious to me than it would written out as three statements. Just as I like methods with a single clear purpose, I prefer statements that have a single clear purpose such as "copy an element from y to x", or "increment i". > If your observation that such expressions has any evidence to back it up > it's a good argument for something. Maybe not for changing the potency > of the auto-inc/decrement operator but for hiring better-trained > programmers, but for something. Assuming the evidence sustains the > observation. > > If you have a hard time understanding that expression and you call > yourself a Java programmer, there's a disconnect. > Fortunately, I don't care about being a Java programmer, or a C programmer, or any other qualified sort of programmer. I'm just a programmer. For my purposes, writing simple, obvious code in whatever language I happen to be using is far more important than showing off my understanding of the JLS. The JLS itself agrees with me on this: "It is recommended that code not rely crucially on this specification. Code is usually clearer when each expression contains at most one side effect, as its outermost operation, and when code does not depend on exactly which exception arises as a consequence of the left-to-right evaluation of expressions." [http://java.sun.com/docs/books/jls/third_edition/html/expressions.html#15.7] The block: { x[i] = y[i]; i++; j++; } follows that recommendation. Squishing all three side effects into one statement does not. I would go against a JLS recommendation about how to use the language only if I had a strong positive reason to do so. That is especially the case when it is arguing for simplicity, which I would prefer anyway. Patricia