Skip to content
BENIBIX Learn

Type System

Also known as Type Checking, Type Checker

Rules that sort values into kinds. They check how each kind is used.

Think of it like

Think of it like shaped holes in a toy box. A square block will not go in the round hole.

Example

Lucy's code tries to add 5 to a list of names. Her type checker stops it before the program even starts.

Why it matters

Many bugs are a value of the wrong kind in the wrong place. A type system finds them for you.

Definition

A type system is the set of rules a language uses to decide what kind each value is. It says what you can do with each kind: you can add two numbers, but not a number and a list. Some languages check the rules before the program runs. Others check them only while it runs. A strict type system catches many mistakes early, before a user ever sees them.

Common mistake

Thinking types only matter in languages that make you write them. Python has types too; it just checks them later.

Key takeaways

  1. 1
    Kinds of value. Number, text, list and more.
  2. 2
    Rules for each. What you may do with it.
  3. 3
    Checked early or late. Before running, or while running.