Rill v0.13 Reference

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.

  1. →Getting startedRill comes as one directory: the compiler, the runtime it links into every program, the standard library, the examples and this reference.
  2. 1Program structureA program is one or more .rill files.
  3. 2TypesTypes are inferred; annotations are optional and only ever needed to resolve an ambiguity or to document intent
  4. 3ExpressionsEverything is an expression; there are no statements that don't produce a value (except bindings).
  5. 4FunctionsFunctions are values: pass them by name (map(xs, double)) or as lambdas.
  6. 5TraitsA trait declares an interface; an impl provides it for one type.
  7. 6MemoryRill has no garbage collector.
  8. 7ConcurrencyRill uses Go's model: many lightweight threads over rendezvous channels.
  9. 8The preludeEvery program has these in scope; any definition of your own with the same name replaces the prelude's.
  10. 9SocketsTCP, with the scheduler doing the waiting.
  11. 10Filesread_file and write_file are for a file a program wants all of at once.
  12. 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'
  13. 12Built-in functions
  14. 13The toolchainA test is a function named test_...
  15. 14What Rill deliberately does not have
  16. 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.
  17. 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.