Clone wiki

inf225public / glossary / Dynamic typing

[Alphabetical Index | Tag Index]

Dynamic typing

When type safety is enforced at runtime. Values are associated with type information, which can also be used for other purposes, such as runtime reflection. Used in languages such as Python, Ruby, Lisp, Perl, etc.

Benefits

Compiler may run faster; easy to load code dynamically at runtime; allows some things that are type safe but are still excluded by a static type system; easy to use Duck typing to get naturally generic code with little overhead for the programmer; reflection, introspection and metaprogramming becomes easier.

Drawbacks

Type errors cannot be detected at compile time; rigorous testing is needed to avoid type errors; some optimisations may be difficult to perform (less of a problem with Just-in-time compilation). Dynamic typing does not imply Weak typing. C.f. Static typing, Duck typing.

[Wikipedia]

Updated