Version 0.13
The Rill Language Reference
Rill is a strict, statically typed functional language that compiles to native executables. This document describes the whole language; every construct shown here is exercised by the test suite.
- →Getting startedRill comes as one directory: the compiler, the runtime it links into every program, the standard library, the examples and this reference.
- 1Program structureA program is one or more .rill files.
- 2TypesTypes are inferred; annotations are optional and only ever needed to resolve an ambiguity or to document intent
- 3ExpressionsEverything is an expression; there are no statements that don't produce a value (except bindings).
- 4FunctionsFunctions are values: pass them by name (map(xs, double)) or as lambdas.
- 5TraitsA trait declares an interface; an impl provides it for one type.
- 6MemoryRill has no garbage collector.
- 7ConcurrencyRill uses Go's model: many lightweight threads over rendezvous channels.
- 8The preludeEvery program has these in scope; any definition of your own with the same name replaces the prelude's.
- 9SocketsTCP, with the scheduler doing the waiting.
- 10Filesread_file and write_file are for a file a program wants all of at once.
- 11Calling CA Rill function may have any name, C's own included: fn read, fn bind, fn connect are the program's, since no Rill function is a symbol anything outside the object can see — only export fn and main are — and the runtime'
- 12Built-in functions
- 13The toolchainA test is a function named test_...
- 14What Rill deliberately does not have
- 15The grid librarynum/grid is Rill's array library: arrays of numbers with a shape, the way NumPy has them, written in Rill on one buffer — and, on one core, ahead of NumPy on eight of twelve benchmarks and level on the other four.
- libThe standard library43 modules — text, data formats, collections, numbers, the web, the network, databases, the command line, cryptography, randomness, time — each documented from its own comments.