The Rush language
A short, honest tour of RushScript, written from Rush's own documentation.
What Rush is
Rush is two things fused into one binary: a process runtime and a language, RushScript, that runs on it. RushScript is interpreted: the author runs no separate compile step.
Values, not variables
Rush has no variables. A bind joins a label, an unquoted name, to a value: port = 8080 binds the label port to the number 8080.
port = 8080Brackets everywhere
[ and ] are the only grouping brackets. They hold call arguments, list and map literals and grouped expressions. Arguments are separated by commas: add[10, 20]. Parentheses are refused outside text.
add[10, 20]Every line does something
A line binds, calls or routes. A line that only names a value, like 5 or x, does nothing, so it is refused with the error RX0065.
x = 5
write[x]Writing output
write['hello world'] prints to standard output. write.log and write.debug are the two other kinds of speech: the first for the system talking to the user, the second for the developer, shown only when DEBUG=1.
write['hello world']Binding and pairing
= binds a name to a value; : pairs a key with its value. They are two acts with two spellings: cfg = [port: 8080].
cfg = [port: 8080]Shapes that enforce themselves
Declare a shape as a map of rules and attach it with :. A value that breaks a rule is refused at the door, not discovered later.
Banana = [grams: number.real.ge[120].le[180], length_cm: number.real.ge[12].le[25], id: text.uuid]
good = [grams: 150, length_cm: 18, id: '…']: Banana
bad = [grams: 999, length_cm: 18, id: '…']: BananaValidators, no imports
These are language builtins, not a library: email, ipv4, ipv6, uuid, url, iso8601, rfc3339, cpf, cnpj, cep, phone, hex and base64.
Honest status
Rush's own documentation says it plainly: young, fast, not ready, on purpose. Read this page as a tour, and the engine's own documents as the authority.
Sources
This page was written from the following files of Rush's documentation tree. Only the examples and rules stated there are used. The files are written in English.
/f/dev/rush/README.md (What Rush is: Runtime + Language; Why use rush instead of Python)/f/dev/rush/doc/FLOPS/09_language.md (Values, not variables; Brackets everywhere; A line holds an expression; A key-value pair is key: value; The output verb; The Banana)
