Home > Articles > Programming

  • Print
  • + Share This
From the author of

Implicit Types

Lisp originally supported two types: lists and atoms. In fact, lists were really pairs, but the second element of a pair could also be a pair, leading to arbitrarily long sequences. Lisp evolved other types later, but they never have to be annotated explicitly. You can always query a Lisp object to find out its type and try manipulating it.

This kind of dynamic typing is common in modern scripting languages. In Lisp, it was quite novel. Earlier programming languages often omitted explicit typing. Most notably, assembly languages rarely tag memory locations with type information, but these languages required that the user always keep track of the type of every memory location or register. With Lisp, the language runtime environment kept track and could always be interrogated if the user forgot. This facility was very important for implementing garbage collection; if the environment didn't know what was an atom and what was a pointer, it couldn't trace the memory.

  • + Share This
  • 🔖 Save To Your Account