Programming Languages - shivamvats/notes GitHub Wiki

There are two different ways to classify programming languages on the basis of the guarantees they provide.

  1. Static and Dynamic
  2. Strongly typed and Weakly typed

Language implementations can be classified as:

  • Compiled and Interpreted

Static vs Dynamic

A statically typed language has a type system that is checked at compile time by the implementation (compiler or interpreter). The type check may reject certain programs and the ones that are accepted come with certain guarantees, like the compiler guarantees not to use integer arithmetic instructions on float objects.

A dynamically typed language has a type system that is checked by the implementation at run time. This means that values are classified into types at run time rather than being specified (or determined) at compile time. There are restrictions on these types as well and their violation is reported as dynamic type error.

Strongly typed vs Weakly typed

The term strongly typed is not well defined. Broadly speaking, in a strongly typed language, one cannot work around the language's type system. For example C is weakly typed because any pointer type is convertible to any other pointer type simply by casting.

One way to replace the word with the substance is to ask yourself this question, "Is every value of a given type guaranteed to have been constructed by calling one of that type's constructor?"

Further reference: StackOverflow

⚠️ **GitHub.com Fallback** ⚠️