logoalt Hacker News

mrkeenlast Monday at 6:25 AM2 repliesview on HN

> Erased generics the type information is not available at run time. That's the way Java does it and it kinda sucks.

In a good statically-typed language you don't need runtime type information. It could be a Void in the bytecode for all I care, as long as it behaves correctly.

> obj.GetType() == typeof(typename)

In a statically-typed language, this can be optimised away to a bool at compile time.


Replies

Gibbon1last Monday at 9:21 AM

Oh absolutely not true AT ALL.

positr0nlast Monday at 3:13 PM

Occasionally it is really useful to be able to do something like `new T()`. Without reified generics that is not possible.

show 1 reply