A tour of Tin
Eight short chapters. Every code block is a real file from examples/,
and every output is what the test suite checks. Already know Python or TypeScript?
Here's the cheat sheet.
- 01 Hello, TinA program is a file with a
main. Strings interpolate, and everything is an expression. - 02 Structs and sum typesData is described with
type. A sum type lists every shape a value can take, andmatchmust handle all of them. Every value is copied, never shared. - 03 No null, no exceptionsA value that may be missing is an
Option. An operation that may fail returns aResult.?passes the failure up. - 04 Functions, pipelines and closures
x |> f(y)meansf(x, y), and so doesx.f(y). Use whichever reads better. - 05 GenericsGeneric code is specialised at compile time.
Stack<int>andStack<string>become separate WebAssembly functions. - 06 Concurrency without coloursThere is no
asynckeyword. Any function can suspend, and callers don’t have to know.spawnstarts a task,awaitwaits for it, and no task outlives its parent. - 07 Tools and agentsA
tool fnis a function the compiler also describes to a model. Anagentis called like a function. - 08 Guarded tools and teamsPut a human in the loop with one word. Compose agents with the tools you already know: sub-agents,
spawnand|>.