proj-plbook-plChTypeConstructs

Table of Contents for Programming Languages: a survey

Chapter : typing and correctness/safety

dynamic vs static vs semidynamic

tradeoffs

expressive type system -> complex

no type inference -> simpler but less concise

type inference -> concise but complex

dynamic typing -> less strict (safe)

want: safe, expressive, simple, concise (unsolved problem)

non-safety tradeoffs regarding of types

types also help a ton with IDEs, see below

they can also make code more self-documenting

they can also help enforce architectural constraints in teams

they can also help performance

they can also lengthen compile-time

nonstrict type coercion

nullable pointer types

pre- and post-conditions

parametric polymorphism (generics)

types as OOP class members

in some languages, instead of or in addition to special syntax to define a class parameterized by a type, one can simply declare a type as a member of the class.

e.g. in Scala: http://docs.scala-lang.org/tutorials/tour/abstract-types.html

notes on differences between Abstract Type Members versus Generic Type Parameters:

...

and type functions

and C++ templates

see "The Generic Dilemma" http://research.swtch.com/generic

if you have interfaces but not generics (like Go), what you are missing is the ability to write a function with a signature like:

KeyIntersection?(Map T1 T2, Map T1, T2) : Map T1 T2

instead you must write something like:

KeyIntersection?