Re:Project Kotlin - a statically-typed JVM language develope...
by masklinn on Wednesday July 20, 2011 @08:24AM
(#2785150)
> Does the ability to retain this information at runtime on a platform without inherent support for this cause noticeable slow down or is it practically negligible especially when compared to typical bottlenecks?
You need to generate a type for it at compile time, but I expect there's not much (if any) runtime overhead, and it can allow for type-specialized collections (e.g. a specialized collection instead of the generic ArrayList<Int>).
On the other hand, in languages like Java or C# (the niche it aims for), because the language is actually quite dynamic (compared to Haskell) and has casts you need reified generics to stay type-safe, type erasure is too easy to bypass to be safe (GHC implements generic collections via type erasure, but that's not really an issue in haskell)
You need to generate a type for it at compile time, but I expect there's not much (if any) runtime overhead, and it can allow for type-specialized collections (e.g. a specialized collection instead of the generic ArrayList<Int>).
On the other hand, in languages like Java or C# (the niche it aims for), because the language is actually quite dynamic (compared to Haskell) and has casts you need reified generics to stay type-safe, type erasure is too easy to bypass to be safe (GHC implements generic collections via type erasure, but that's not really an issue in haskell)