Step-by-step tutorial
This tutorial leads from your first variable to a small service. Unlike the tour, where every page shows features in a condensed form, every step here is built the same way:
- Why - which problem the feature solves and why the language is designed this way;
- Example - a complete program you can paste into a file and run:
oxl run file.oxl; - Output - what the program prints (the "Output" box is verified together with the code on every site build);
- Walkthrough - line by line, what happened;
- Common mistake - a short program that does not compile, and the compiler diagnostic with a link to its description.
All you need is an installed oxl (installation). Every example is a single file; apart from step 9
(modules and packages) you do not need to create projects.
oxl run step.oxl # build and run
oxl check step.oxl # type-check only, no run
oxl fmt step.oxl # canonical formatting| Step | Topic | Main idea |
|---|---|---|
| 1. Variables and types | let, var, numbers, strings, T? | everything is immutable by default |
| 2. Functions | parameters, defaults, closures | the last expression is the result |
| 3. Data: data and enum | records, variants, methods in impl | a type describes the allowed states |
| 4. Pattern matching | match, if let, unions A | B | the compiler checks you covered everything |
| 5. Errors | @error, fail, ?, chains -> | an error is part of the signature |
| 6. Collections and iterators | List, Map, Set, iter, queries | lazy pipelines |
| 7. Ownership and borrowing | move, &, &var, clone | memory safety without a garbage collector |
| 8. Effects | pure, io, time, net, db | the signature tells what a function does |
| 9. Modules and packages | use, pub, oxl.toml | the module is the visibility boundary |
| 10. Tests | test, assert_eq, tables, fuzzing | a test is a language declaration |
| 11. Concurrency | scope, tasks, channels, select, actors | structured concurrency |
| 12. A small service | service, rpc, actor, cluster | one code base - in process and over the network |
After the tutorial go to the cookbook of examples, the tour of the distributed features (cluster, sagas, deployment) and the Standard for the exact rules.