Do everything in Java…

Russel Winder via Digitalmars-d digitalmars-d at puremagic.com
Sat Dec 6 07:37:15 PST 2014


On Sat, 2014-12-06 at 15:49 +1300, Rikki Cattermole via Digitalmars-d wrote:
> On 6/12/2014 3:12 p.m., H. S. Teoh via Digitalmars-d wrote:

> > I dunno, while type erasure is certainly annoying when you 
> > actually need information about the type, it's also eliminates 
> > template bloat. I think the ideal system should be somewhere in 
> > between, where type erasure is actively performed by the compiler 
> > where the type information is not needed, while template 
> > instantiations are retained when it is needed. This should keep 
> > template bloat under control while still offering full template 
> > capabilities. D currently leans on the template bloat end of the 
> > spectrum; I think there is much room for improvement.

The best solution is to not have generics, just like Javas 0 to 1.4. 
Every container is a container of references to Object. OK so Go has a 
quite neat solution.

(OK this is part troll. Given all the Java, D, Go, Python,… 
discussions of generics I see the whole topic is beginning not to get 
me worked up at all.)
> 
> Its a bit more then annoying. What happened when it was originally 
> implemented was basically hacking of the compiler to support it, 
> type erasure wasn't a design decision to my understanding.
> Then again the last time I checked Java's reference compiler / jvm 
> source code it was a real mess to say the least.
> If I remember right an xml parser lib was at the same level in the 
> repo as the compiler and nothing else at that level. This was only a 
> few years ago now.

Erasure originally arose because the generics team were told they 
couldn't change the JVM: the JVM definition was sacrosanct on the 
altar of backward compatibility. Of course the Annotations team were 
told the same thing and then changed the JVM definition anyway.

So type erasure was a hack.

Since then many people, probably suffering from Stockholm Syndrome, or 
being Scala type management infrastructure folk, no believe type 
erasure is the right thing for the JVM. There is a vocal contingent 
pushing for type parameter reification, as was done in CLR, but I 
think there are too many influential people saying "won't happen" for 
it to happen.

Java 9 should see a far better structured JVM source code and runtime 
system.

> I really hope I'm wrong or its changed since then but who knows.

Some things have changed. Some would say not enough. The LJC (of which 
I am a member) is on the JCP EC so we get to vote. We are generally on 
the side of "no corporate politicking, get stuff done to help Java 
programmers". cf. the rewrite of the OpenJDK build system, the 
AdoptAJSR and AdoptJDK programs which have been hugely successful. 
More user groups are getting more stuff into OpenJDK than ever before. 
Obviously though Oracle and IBM are still the main players.

-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder at ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel at winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder



More information about the Digitalmars-d mailing list