News for hackers. Stuff that matters.
Re:How generics were added to .NET by masklinn on Tuesday March 06, 2018 @06:56AM (#16528272)
> Note also that Java does have reified generics, but only for arrays.

By that count, so does C.

Re:How generics were added to .NET by TheCoelacanth on Tuesday March 06, 2018 @12:10PM (#16530165)
Java has generics but they are only reified for arrays.

C has types that are only generic in the case of arrays.

There is a difference.

In Java I can write this function

    <T> String getTypeOfArray(T[] arr) {
        return arr.getClass().getComponentType().getName();
    }
and that will return the name of type T at run-time. If I instead of T[] I use List<T>, getComponentType will return null and there is no way to access what type T is at run-time. At compile time List<T> and T[] behave the same, but at runtime the List loses what type if contains.

In C I can't write a function with that signature at all because it doesn't support generic functions.

Re:How generics were added to .NET by Sharlin on Tuesday March 06, 2018 @10:35AM (#16529426)
C has no runtime type information at all. Java knows the difference between Integer[] and Float[] at runtime but not between List<Integer> and List<Float>.