Language reference
What MUL does not have
Do not write these: the compiler rejects them. The first table lists features that are planned, with the version they are planned for. The second lists things MUL leaves out by design.
Not yet
| Construct | Today | Planned |
|---|---|---|
for, break, continue, match |
while with a counter var; return from the body |
after v0.1 subset |
effects alloc, async, unsafe; several effects on one function |
pure and io only, one per function |
v0.1 language |
string operations: +, ==, length, indexing, formatting |
literals, variables, parameters and print only; == is MUL-T015 |
v0.1 language |
printing numbers, conversions between string and i32 |
return the number from main (--print-result) |
v0.1 language |
| input (reading stdin, files, arguments) | none | not planned yet |
i64, f64, other integer sizes, unsigned types |
i32 only |
v0.1 language |
hex, binary or _-separated literals, character literals |
decimal digits only | not planned yet |
structs, enums, Option/Result, methods, interfaces |
none | v0.1 language |
import, export, several modules in one program |
one module per program | v0.1 language |
| generics | none | after the v0.1 semantics are stable |
semicolons, block comments /* */ |
statements need no separator; // only |
not planned |
| trailing comma in parameters or arguments | rejected (MUL-S002) |
not planned |
module-level let/const |
a parameterless function | v0.1 language |
compound assignment +=, ++, multiple assignment a, b = b, a |
x = x + 1; a temporary let |
not planned yet |
if as an expression, ternary c ? a : b |
an if statement assigning a var |
not planned yet |
bool ↔ i32 conversions |
if returning 1 or 0; n != 0 |
not planned |
Not by design
- Shadowing. A name cannot be declared again while it is visible
(
MUL-T010), so one name means one variable wherever it is visible. - Uninitialized variables. Every
letandvarneeds a value. - Assignment as an expression.
a = b = 1andf(x = 1)are rejected. - Truthiness. Only a
boolis a condition:if n { }isMUL-T012. - Chained comparisons.
a < b < cisMUL-S005, not a range check. - Non-short-circuit
&and|. Only&&and||exist. - Classes and implementation inheritance. Behaviour will attach to structs through methods; polymorphism uses interfaces and composition.
- Wrapping or undefined arithmetic. Overflow and division by zero always
trap with a stable code (
MUL-R002,MUL-R003), in every backend. - Unbounded recursion that crashes the process. The call depth limit turns
it into
MUL-R005. - Implicitly shared mutable state. The memory model (RFC-004) is not written yet, but this rule is fixed.
- Cryptic shorthand for brevity. MUL aims to be short for AI through operations on the IR, not through dense syntax.
This page is docs/language/ in the repository, published as it is. Every mul code block on it is compiled and run by the test suite.