Penguin
Diff: PolymorphicTypes
EditPageHistoryDiffInfoLikePages

Differences between version 3 and previous revision of PolymorphicTypes.

Other diffs: Previous Major Revision, Previous Author, or view the Annotated Edit History

Newer page: version 3 Last edited on Tuesday, April 8, 2003 8:47:24 am by SamJansen Revert
Older page: version 2 Last edited on Tuesday, April 8, 2003 8:34:52 am by SamJansen Revert
@@ -16,9 +16,9 @@
  
 [ML] and [Haskell] have polymorphic typing. 
  
 In [C] you can approximate polymophic typing with __void__ pointer arguments, which will take pointers to any type. In [Java] and [C++] approximate polymorphic typing by using Object classes, which all objects belong to. But in both cases you lose strong type checking, so the quality of your code suffers. 
-''It should be noted here that [C++] has templates, which allow strong type checking with PolymorphicTypes . These are often called GenericTypes . -- SamJansen'' 
+''It should be noted here that this page is talking about what is sometimes known as __parametric polymorphism__. [C++] has templates, which satisfy the definition above, but are known to be syntactic; each instantiation creates a specialised version of the code . In a "true polymorphic system" only one version of the generated code would be used. There are other ways to have polymorphic types, they often come up in ObjectOriented ProgrammingLanguages. Oh, and parametric polymorphism is also often referred to as generics . -- SamJansen'' 
  
 !!!An Example 
  
 This is Glyn defining a binary tree type on his [Ocaml] interpreter: