Introduction

We distinguish 2 types of languages: typed (Java, C#, etc.) and untyped (Python, Scala, JavaScript). A type is a set of values, like:

In typed languages:

These languages will throw out exceptions when an expected type differs from the found one:

Untitled

This is the whole idea of type checking: making sure we avoid type errors.

Why do we care about this? If we have a weak typed language, where we don’t check the types, like C, catastrophic errors may happen:

Untitled

This is known as the heart bleed bug, which allowed anyone on the Internet to read the memory of the systems protected by the vulnerable software. This comprised the secret keys used to identify the service providers and to encrypt the traffic, the names, and passwords of users and the actual content.

What is Type Checking?

There are multiple definitions of what Type Checking is: