|
|
|
|
|
by marhee
532 days ago
|
|
> C++ breaks parametricity even with normal templates I might be wrong here, but as I understand it "parametricity" means loosely that all instantiations use the same function body. To quote wikipedia: "parametricity is an abstract uniformity property enjoyed by parametrically polymorphic functions, which captures the intuition that all instances of a polymorphic function act the same way" In this view, C++ does not break parametricity with "normal" (i.e. non-specialised) templates. Of course, C++ does not type check a template body against its parameters (unless concepts/trairs are used), leading to the problems you describe, but it's a different thing as far as I understand. |
|