Path: csiph.com!usenet.pasdenom.info!gegeweb.org!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: Tsukino Usagi 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 22:17:34 +0900 Organization: Moon Kingdom Lines: 66 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Fri, 20 Apr 2012 13:17:41 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="WNQAnFnSYTf0is63zyCXnA"; logging-data="21617"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18rHKhHZAfiX20BbIFfIedr" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 In-Reply-To: Cancel-Lock: sha1:cISyw9DtL21BMSf7BHkHKhhJeM0= Xref: csiph.com comp.lang.java.programmer:13688 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); > > 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.