Types and why you should care

Typed vs Untyped

Typed

Untyped

Fortran

C

C++

Java

Swift

Rust

OCaml

Haskell

Lisp

Python

JavaScript

Ruby

Lua

Clojure

Racket

Some vocabulary

  • Value
  • Variable
  • Expression
  • Type

Typed vs Untyped

  • untyped: values have types
  • typed: variables and expressions have types

Why Types?

  • Make programs faster
  • Make programs easier to reason about

How do types hurt?

  • Increase verbosity
  • Cause confusion
  • Slow you down
  • Interfere with your plan

How can types help?

  • Improve performance
  • Detect errors
  • Communicate your intent
  • Inform your tools
  • Guide refactoring
  • Enforce invariants

Things to remember

  • Don't judge types by their worst face
  • Don't forget the tradeoffs
  • Learn more languages!

Types and why you should care

By Yaron Minsky

Types and why you should care

  • 172