Language reference
A concise public reference derived from the Language V1 specification and release contract. Proposed features are not included.
Programs and declarations
An executable uses top-level executable statements or one non-generic zero-parameter main() returning unit/void or int, never both. let and var are inferred mutable declarations. Explicit declarations use type-before-name. const requires an explicit type; readonly supports inferred and explicit forms.
let samples = [10, 20, 30]
const double gravity = 9.80665
readonly let answer = 42Shipped types
Array suffixes compose: int[][] is an array of arrays. Numeric conversions remain checked by the language contract.
Control flow and functions
Brace-delimited blocks form lexical scopes. Implemented constructs include if, while, range and C-style for, switch, loop control, functions, lambdas, returns, exceptions, resource scopes, member access, and indexed mutation.
function square(int value) -> int {
return value * value
}
for value in [1, 2, 3, 4] {
printLine(square(value))
}Expression precedence
| Item | Contract |
|---|---|
|| | Logical OR; left |
&& | Logical AND; left |
== != | Equality; left |
< <= > >= | Relational; left |
+ - | Additive; left |
* / % | Multiplicative; left |
+ - ! | Prefix unary; prefix |
^ | Exponentiation; right; binds more tightly than unary |
(...) [...] .name | Postfix call/index/member; left/chained |
Physical quantities
Unannotated numeric values are dimensionless. Dimensioned literals use built-in or user-defined units. The built-in SI bases are m, kg, s, A, K, mol, and cd. Absolute temperature points and temperature differences have distinct affine semantics.
let force = 20 kN
let area = 200 mm^2
let stress = force / area
unit furlong = 201.168 m
let distance = 3 furlongProjects and modules
A sibling ss.json closes the source set and selects the identifier-case policy. Sources may declare one module and explicit non-transitive imports. Exported members are qualified by module; private members remain inaccessible. Without a project file, the selected source is compiled with the sensitive identifier default.
Diagnostics and status
Compiler diagnostics identify the owning source and use file(startLine,startColumn)-(endLine,endColumn): error CODE: message. Status 0 is success, 1 represents source/build/test/runtime failure after a valid invocation, and 2 represents usage, input, project, package, I/O, or unavailable-toolchain failure.
Documentation version
Language 1.0.0, compiler 1.0.0, runtime 1.0.0. This reference is generated from the official SS documentation so package and language details stay consistent with the release.