| Author |
Reification
|
Wouter Oet
Saloon Keeper
Joined: Oct 25, 2008
Posts: 2700
|
|
I don't really know the details but this looks interesting:
http://twitpic.com/37ky8w
It's from Mark Reinhold's presentation at Devoxx.
|
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
|
 |
Jelle Klap
Bartender
Joined: Mar 10, 2008
Posts: 1430
|
|
Hmm, run-time availability of type-information (generics).
No more type erasure? Well, there goes binary compatibility...
I don't see this happening anywhere in the immidiate future.
|
Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
|
 |
Pat Farrell
Rancher
Joined: Aug 11, 2007
Posts: 4437
|
|
I'm not convinced that type-erasure is a good idea, long term. It was a needed hack to allow pre-Java-5 bytecode to run, but it adds a lot of complexity and can bring subtle bugs.
I would be happy if it went away in some suitable future Java-like language.
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19230
|
|
Jelle Klap wrote:Hmm, run-time availability of type-information (generics).
I probably missed something, because I didn't see anything like that. All I saw was:
- being able to use primitives as generic types
- type inference for the instantiation
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12950
|
|
I don't know why Mark Reinhold showed this example while he was talking about type reification (see the photo: the title of the slide is "Language Futures: Reification").
Type erasure was an unfortunate idea that made it into Java, only because raw types needed to be supported for backward compatibility. Type erasure has lead to a number of warts, like the impossibility of creating arrays of a concrete parameterized type. Other languages, Scala for example, are also bothered by type erasure; in Scala there is an ugly workaround (manifests) to get generic type information at runtime.
In my opinion, generics should never have been implemented with type erasure - and now it is much harder to add type reification to Java because everything has to stay backward compatible. It would be nice if we could get rid of type erasure in Java and the JVM, but it's not going to be easy.
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19230
|
|
I fully agree on type erasure. Without it, it would (probably) even be possible to instantiate instances and arrays (new T[10] anyone?) of generic types. I even made up a syntax for the first:
In this example, Integer can only be used with doSomething1 and doSomething3. It misses the constructors required for doSomething2 and doSomething4 and therefore cannot be used there.
|
 |
 |
|
|
subject: Reification
|
|
|