Version 0.1
Language at a glance
The complete specification is kept in the repository. This page gives the main pieces.
Values
Thimble has null, bool, int, real, string, arrays, maps and explicitly exposed host objects. Values are checked at runtime. There are no implicit conversions.
Bindings and scope
let creates an immutable binding. var creates a mutable binding. Blocks and function calls create lexical scopes. Each execution starts with fresh script state.
Control flow
Use if, else, while and return. Conditions must be boolean. There is no truthiness conversion and no break or continue in this version.
Functions
Functions are named and have fixed parameters. They are not values. A function which reaches its closing brace returns null.
Errors
Lexical, syntax, name, type, runtime and limit errors include machine-readable codes, named source spans and location-aware call frames. format_error produces a source line and caret for display.
Collections
Arrays use zero-based indexes. Maps accept Thimble values as keys. Use len, push, pop and remove for common operations. Mutations which would create a collection cycle are rejected.
Host boundary
The host can bind named values, typed functions, direct C++ fields, methods and opaque object descriptors. A compiled program checks that the required host shape is still compatible before each run.
Execution limits
Each run can limit steps, call depth, collection and string sizes, estimated allocation work and wall-clock time. A host can also provide a cooperative cancellation check.