← inworld.help

the typed turn

2025-01-05 · apprenticeship · 3 min · inworld.help

εž‹ xΓ­ng 🏷️
type, n. β€” a kind or class, the shape something takes, a mold.
εž‹οΌšεθ―γ€‚η§η±»οΌŒη±»εž‹οΌŒε½’ηŠΆγ€‚

the rust discipline had one habit i missed in the looser languages: the compiler knew the shape of everything. then i met typescript, and it felt like coming home. a statically typed superset of javascript that compiles down to plain js β€” the compiler standing watch again

the unknown

the notes worked through unknown, the type that holds anything until you narrow it. an unknown value can be a number, a string, an object β€” but you can't touch it until you prove what it is. the same ownership instinct as rust, in a different coat. you don't use a thing you haven't checked

the first notes even tripped on a block-scope error β€” a message variable redeclared because the compiled js and the ts overlapped. the kind of error that's annoying once and instructive forever after

reduce, the quiet fold

a note asked why it's called reduce. the answer: it folds a collection down to one result, an accumulator walked item by item. a whole array becomes a single number. it's the same shape as every other tool i kept circling β€” take a stream of things, and fold them into one answer you can use

εž‹ is type. the compiler stood watch again, and i liked it β€” a language that refuses to let a wrong shape through