Received: by 10.68.222.225 with SMTP id qp1mr3256228pbc.8.1350317487220; Mon, 15 Oct 2012 09:11:27 -0700 (PDT) Received: by 10.68.189.37 with SMTP id gf5mr2530704pbc.16.1350317487204; Mon, 15 Oct 2012 09:11:27 -0700 (PDT) Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!nntp.club.cc.cmu.edu!newsfeed.news.ucla.edu!usenet.stanford.edu!kr7no30496788pbb.0!news-out.google.com!jt13ni12003pbb.1!nntp.google.com!kt20no35546318pbb.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.java.programmer Date: Mon, 15 Oct 2012 09:11:27 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=173.164.137.214; posting-account=CP-lKQoAAAAGtB5diOuGlDQk0jIwmH0T NNTP-Posting-Host: 173.164.137.214 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Assigning void From: Lew Injection-Date: Mon, 15 Oct 2012 16:11:27 +0000 Content-Type: text/plain; charset=ISO-8859-1 Xref: csiph.com comp.lang.java.programmer:19360 Jukka Lahtinen wrote: > Lew writes: > > > 'if' is two keys plus 'then' is four for six keys. '?' is two keys. Right - '{' and '}' are four keys. Sorry. >> 'else' is four keys, ':' is two. > > But 'then' is not Java. I have no excuse. The only reason I can imagine for this is that I have been doing a lot of bash coding lately. But still. >> Advantage: '?:' ten to four. > >> But for clarity, most ternary expressions require a pair of parentheses, >> adding four keys. Now the advantage is ten to eight. > >> And '?:' loses its place as an operator. Another point I should clarify - "operator" is not a sufficient distinction. I should have said "simple operator" or some such phrase to distinguish operators like the ternary one here, the arithmetic operators, comparison operators and the like, whose purpose is not to cause a state change but to produce a value. It's pretty clear that the Java designers viewed these categories of operators differently, as that difference is codified in the language. -- Lew