Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: Wojtek Newsgroups: comp.lang.java.programmer Subject: Re: Assigning void Date: Sat, 13 Oct 2012 12:28:02 -0700 Organization: A noiseless patient Spider Lines: 58 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15"; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: mx04.eternal-september.org; posting-host="02a139954f423f27040ed3cd2ab90b3b"; logging-data="1807"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+rSccNiRpNf9SJx5+08zPU9j+1+3veiTw=" X-Newsreader: MesNews/1.08.03.00-gb Cancel-Lock: sha1:+2HKRz0RQIBkPyVT48y6Dob0ZEk= Xref: csiph.com comp.lang.java.programmer:19290 markspace wrote : > On 10/12/2012 10:54 PM, Wojtek wrote: >> both ftp methods return void. I would think that the compiler would >> be smart enough to realize that nothing CAN be returned. > > > On 10/13/2012 11:26 AM, Jeff Higgins wrote: >> Does it sound childish to ask why? > > > The way the OP puts it, yes, it comes across as a bit childish. The OP > didn't ask "why," he asked for "thoughts." My thought is "read the JLS." Hmm, I wasn't questioning the compiler as I would hope it follows the JLS. Yes, I have a C background, and I have used this expression many times, and indeed I have nested it several layers deep, since it made most sense (to me) to do so. > I realize *you* asked why, but in the vein of the OP's premise, I feel "read > the spec" is a valid answer. "Why" requires reading someone's mind, and time > travel. Since those are obviously impossible, the result borders on > trolling. So questioning a design decision and trying to understand its rational is trolling? Really? > I'd guess that the original intent and the current thinking is that Java > should be "easy to read" and that shortening branch flow to a single > character pushes somebody's Perl buttons, but that's a total guess. There are many ways and many people who try to write code which is easy to read. Anyone can write obfuscated code, but seasoned coders tend to try to simplify where possible, not use clever tricks, at least IMHO. > What about this: > > (some large expression || some other large expression ) > ? { > Statement; > Statement; > Statement; > } : { > Statement; > Statement; > Statement; > } > Interesting. I had not followed the idea that far. Though in common use it really just replaces a succinct if/else construct. -- Wojtek :-)