Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Robert Klemme Newsgroups: comp.lang.java.programmer Subject: Re: no more primitive data types in Java (JDK 10+). What do you think? Date: Fri, 20 Apr 2012 15:59:25 +0200 Lines: 80 Message-ID: <9vd8duFt6jU1@mid.individual.net> References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net E7+QSqXA1c85+Lr6BHmMzwpGthgYqk51HqEsE7AsRmQxZVX8s= Cancel-Lock: sha1:ISvh/yPo5zgdjEB1GLSk08MvUKQ= User-Agent: Mozilla/5.0 (X11; Linux i686; rv:11.0) Gecko/20120329 Thunderbird/11.0.1 In-Reply-To: Xref: csiph.com comp.lang.java.programmer:13692 On 04/20/2012 03:17 PM, Tsukino Usagi wrote: > On 4/20/2012 7:04 PM, Arved Sandstrom wrote: >> On 12-04-20 03:27 AM, Tsukino Usagi wrote: >>> On 4/20/2012 8:27 AM, Nasser M. Abbasi wrote: >>>> >>>> On page 42, it says: >>>> >>>> "Unified type system (JDK 10+) >>>> No more primitives, make everything objects" >>>> >>>> I've seen very little discussion on this very important >>>> subject. >>>> >>>> What do the experts here think of the idea? >>> >>> It's impossible. Whatever they mean when they say "remove primitives" >>> cannot possibly be what those words actually mean. Just think, how would >>> it be possible to state a = a + 1 without the number 1? Ok, so you can >>> use .add(Integer x). But how precisely do you call it? .add(1)? There's >>> still a 1. And what's worse is if numbers act like objects, which >>> introduces it's own dangerous problem. Is the number 5 really 5, or is >>> it something else? Treating primitives like objects, without them >>> actually being objects, is UN-neccessary and confusing. >>> >>> 5.length() or 5.size()? Well if 5 is an object I should be able to >>> over-ride it. >>> >>> Class 6 Extends 14 {} >>> >>> Is that what they mean, or do they mean they will just treat numbers >>> /like/ objects? I guess I need more information. In the absence of a >>> good reason, I don't believe such a change will ever actually make it >>> into Java. >> >> However they do things there will be problems and concerns. What you >> talk about is not likely to be one of them. In a system where all things >> are objects, numeric literals are objects: they are syntactic sugar. >> >> a = 2; >> >> really means >> >> a = new Integer(2); Rather a = Interer.valueOf(2) as it is done already today with autoboxing. But yes, the literal can be translated to anything. >> and >> >> a = a + 1; >> >> means that a is some Number and you're adding Integer(1) to it. Who >> cares that underneath the hood the compiler translates that to (int)13 + >> (int)1? >> >> Just because you've got literals doesn't mean that you need primitives. >> >> As for instance calls on a literal, you and I already do that with >> String literals. E.g. "some string".length(). >> >> I think you can see that in your example '5' is an instance; Java is >> class-oriented for inheritance/extension, not object-oriented, so you >> won't be extending an instance. But yes, we'd expect that you could do >> 5.someMethod(), for instance methods that make sense. >> >> AHS > > I get what your saying, my point was exactly that requiring Integer(1) > is ridiculous. If your going to type "1", type "1" and be done with it. I am sorry, but that statement proves that you did not get the point. Cheers robert