Skip to main content
6 events
when toggle format what by license comment
Dec 16, 2018 at 18:46 vote accept Vincent
Jul 10, 2017 at 21:28 comment added chi I am not sure I agree with this. Even sans concepts, C++ templates and parametric polymorphism seem to be only very vaguely related to me. A polytyped term is type checked so to guarantee that it will work on all its possible instances. Java generics have that (despite Java breaks parametricity). C++ templates instead employ "SFINAE", where types are not checked until instantiation time, which makes them far from universal types to me.
Jul 10, 2017 at 5:59 history edited Dave Clarke CC BY-SA 3.0
added 49 characters in body
Jul 10, 2017 at 5:57 comment added Dave Clarke @oconnor0: You are right. Concepts + templates give bounded polymorphism. I'll update my answer.
Jul 10, 2017 at 1:58 comment added oconnor0 C++ templates have type restrictions built in to them, creating a form of structural typing, because a type must only have some set of defined operations (implicit in the template definition) to satisfy the type checker. Concepts appear to do much the same thing but allow names to be associated with those sets of behavior (a form of nominal typing) and thus provide a way to produce earlier and better error messages. I also don't think concepts are type to type functions. The linked description describes them as type predicates - or type to boolean functions.
Jul 7, 2017 at 5:09 history answered Dave Clarke CC BY-SA 3.0