Level 1
1 day < 1 min
LeaderboardGuest · Log in
Key point 6 of 8 · Programming Fundamentals
Estimated reading time: 4 min

Type Systems and How Programs Run

A programming language's type system governs how it handles the data types introduced earlier, such as numbers, strings, and booleans, and one of the most consequential distinctions between languages is whether that type system is static or dynamic. In a statically typed language, every variable's type is fixed and checked before the program ever runs, typically because the programmer declares it explicitly or the translator infers it from context, and any attempt to use a value in a way its declared type does not allow is caught immediately, as an error, before the program is executed at all. In a dynamically typed language, by contrast, a variable's type is determined only at the moment the program actually runs, based on whatever value currently happens to be assigned to it, and that same variable can even be reassigned to a value of a completely different type later on without the language objecting in advance; type-related mistakes in such a language typically surface only as runtime errors, and only if the offending code actually executes. Static typing is generally credited with catching a class of bugs earlier and with making large codebases easier for tooling to analyze and refactor safely, while dynamic typing is generally credited with letting programmers write and iterate on code more quickly, with less upfront ceremony.

Food for thought

Why do you think there's historiographical debate about "Type Systems and How Programs Run"?