Saturday, March 22, 2008

Get your types straight

There is an excellent article about trends in programming languages in the 01/2008 issue of OBJEKTspectrum .

One thing I finally got straight are the different terms concerning type-systems. I tried to capture my insights in a sketch:

Typing.jpg

Casting is a mechanism of statically typed languages to defer type checking to runtime and basically behave like a dynamically typed language.

Type Inference is a mechanism of statically typed languages that lets the compiler decide automatically about types. This must not be confused with weak typing.

Duck-Typing is a mechanism where the structure of the actual object matters, and not its declared type. Usually this is used in combination with dynamically typing, but surprisingly it is also used in statically typed languages.

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...