What part of "type" don't you understand?

Type is one of the most overloaded words in computer science. It has at least six important senses:

  1. The representation of a variable, in low-level languages.
  2. The class or constructor of a value, in most dynamically typed languages.
  3. Any set of values, in Lisp.
  4. A protocol or interface an object implements, in Smalltalk.
  5. An intended meaning of values, in static typing.
  6. A theorem about a program, in type theory.

Each of these is the one true sense of “type” to some people, and absurd to others, even though the first five are obviously related.

A lot of misunderstandings come from confusion of different senses of “type”. For example, some static typists say “static typechecking eliminates runtime type errors”. If this means “static theorem checking eliminates runtime theorem errors”, it's trivially true. But “runtime type error” usually means a value of the wrong class, and with this interpretation it's blatantly wrong.

My advice is to avoid the word “type” when you want to be understood, unless you know how your audience will interpret it.

No comments:

Post a Comment

It's OK to comment on old posts.