Error Lab
Every diagnostic below is the real output of ptc, not a mock-up. Pick a mistake, read how the compiler teaches the canonical form, then flip to the fix.
No null
null, nil and None-as-a-value let absence hide in any type. POLYTONE's absence is an Option, and the compiler checks every place it is opened.
let nickname = null
print("{nickname}")The compiler answers
error: unknown name 'null' — there is no null: absence is an Option — 'None' / 'Some(x)', typed by its target ('let x: Option[Int] = None') (line 1, column 16)let nickname: Option[Text] = None
print(nickname.unwrap_or("none yet"))Fixed — and it runs
none yet