News for hackers. Stuff that matters.
Re:Java Generics Are Turing Complete by pif on Thursday May 26, 2016 @10:53AM (#11778379)
My one big beef with generics is that they only work through constraints! With templates, the compiler checks the validity of a template only when applying it to a concrete type; a generic, OTOH, needs to be valid as an independent entity. And this means that you are stuck with the limitations of the constraints: you cannot specify that your type has a constructor accepting parameters, you cannot specify static methods, nor operators.

With generics, you can only pass complete types as generic parameters; templates accepts types, templates and integral constants.

You can't have partial specializations with templates.

Typedef. This is the most annoying limitation I found in C#. You cannot type:

  typedef vector<MyClass> MyList;
and have it valid in the whole project.
Re:Java Generics Are Turing Complete by xenadu02 on Thursday May 26, 2016 @12:53PM (#11779479)
That's not inherent to generics - see Swift, which absolutely allows protocols to require static/class members or initializers. Swift 3 also adds generic type aliases (typedefs).

Having worked extensively with both I think Swift learned a lot from C# (and many other languages).

As for Concepts... No one seems to be able to agree on them so I'm not holding my breath.