News for hackers. Stuff that matters.
Re:Background: how we got the generics we have (2020) by Felk on Thursday April 01, 2021 @08:13AM (#26659471)
As "better" isn't clearly defined, here are some things that some people might consider superior:

- primitives or any custom value types/structs can be used. No need for boxing or method duplication for primitives. - type information available at runtime, no need to pass 'Class<T>' parameters. - type constraint 'new' available, which means it must have a default constructor so you can do 'new T()'. No need to use reflection or pass a constructor parameter. - type constraint 'notnull' available - class-scoped compiler enforced covariance and contravariance, though I think you can get similar results with java's "? extends T" and "? super T" constraints

There are no comments on this comment yet.