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: Eric Sosman Newsgroups: comp.lang.java.programmer Subject: Re: Assigning void Date: Wed, 24 Oct 2012 20:21:11 -0400 Organization: A noiseless patient Spider Lines: 43 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Thu, 25 Oct 2012 00:21:08 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="ffb8f7085759b339c1002252b48331a4"; logging-data="21365"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+/imz3rNffGywad5uggISQ" User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 In-Reply-To: Cancel-Lock: sha1:M6XUzbdy/1cggkdhwgvz+F1ij3Y= Xref: csiph.com comp.lang.java.programmer:19496 On 10/24/2012 7:02 PM, Wanja Gayk wrote: > In article , Eric Sosman (esosman@comcast- > dot-net.invalid) says... >> [...] >> To your second question, I don't think it's as "bad" as all >> that, but neither do I think allowing `void' operands is "good." >> In Java we can say that all operators take actual values as >> their operands and yield actual values as their results > > Which is violated by the "void" return parameter in the first place, so > that can't be a sane base for any assumption regarding Java language > constructs. I'm not entirely sure what you mean. A method can be declared as `void', which (in Java) means it returns nothing at all, not even some C-ish non-value of a vacuous type. The violation you mention escapes my understanding. >> Also, it appears that `void' is not a "type" in Java. That >> may be a controversial position (i.e., I may have to eat my >> words), but note that `void' is not listed as a type anywhere >> in JLS 4. The description of java.lang.Void says it's a place- >> holder for "the Java *keyword* [emphasis mine] void," not for >> a type. So `void' has an entirely different status in Java than >> in C, where it's a full-fledged (but rather special) "type." An >> argument that `void' in Java should behave like `void' in C seems >> to me to be on shaky ground; one might make a similar argument >> about `goto'! > > However, if Java language designers were, at some point in time, to > autobox "void" to "Void", having the compiler or JIT generate the > missing "return null;" calls, which I would like to be honest, then we > would be back where we started with C: Every method had a return value, > and the ternary operator would be applicable everywhere. "Things would be so di-if-fe-rent, If they were not as they are!" -- Anna Russell (Extra credit if you know the tune.) -- Eric Sosman esosman@comcast-dot-net.invalid