Skip to content

Latest commit

 

History

History
66 lines (46 loc) · 3.74 KB

File metadata and controls

66 lines (46 loc) · 3.74 KB

RSScript language card

Source: syntax, diagnostics, and core interface registries.

A compact generated index for contributors and tools.

Machine-readable summary: language-card.json. Diagnostic explanation catalogs do not fabricate fixes; machine-applicable edits are instance-level data returned by rss check --json and rss fix --json.

Canonical call spelling

Named arguments stay named. A direct call-site read wrapper is omitted because it is the default; mut and take remain explicit. The formatter does not invent or remove argument labels. take moves the value out of its binding, so its operand must be a local binding — a let binding and a literal cannot be taken, and a parameter that wants take therefore needs a local on the caller's side.

fn apply(target: mut Buffer, input: take String, note: read String) -> Unit {}

fn update(target: mut Buffer, input: take String, note: read String) -> Unit {
    return apply(target: mut target, input: take input, note: note)
}

Accepted surface sugar

Two alternate spellings are accepted and desugared by the parser to the canonical form. They produce the same AST, so the checker sees only the canonical node, and rss fmt rewrites them to the canonical spelling — formatting is the normalizer.

Also accepted Canonical
T { field: value } T(field: value)
Pattern => expr, Pattern => { expr }

A trailing comma after a block arm (Pattern => { ... },) is accepted too. Prefer the canonical spelling when writing new code.

Canonical surface forms

These are the forms most often written wrong. The right column is what rss fmt prints.

Form Write this Not this
constructor call Report(title: take title, count: 0) Report { title: title, count: 0 }
match arm Ok(value) => { return value } Ok(value) => value,
task_group, with and select are statements task_group { spawn work() } let results = task_group { spawn work() }
no tuple destructuring in for for key in Map.keys(map: counts) { } for (key, value) in counts { }
mutable binding let mut total: Int = 0 mut total: Int = 0
a value you will take is bound with local local title = "daily" let title = "daily"
take moves a binding, never a literal local title = "daily"; build(title: take title) build(title: take "daily")

Core interface signatures

450 callable signatures across 59 namespaces are prelude-visible to a single-file check. The full list, grouped by namespace and generated from the interface sources themselves, is signatures.md; the machine-readable form is the signatures array of language-card.json.

At a cursor, rss generate continuations returns the signatures for the namespace being typed, and every callable candidate carries its parameters as data: the label to write, whether that label may be dropped, and the effect the call site has to supply. Argument labels are the callee's own names, not the caller's: String.split takes value and delimiter, not text and separator. Read them rather than guessing them.