From acb8a2c7c0269bf5890bdc97b80f307d969e4f77 Mon Sep 17 00:00:00 2001 From: Bryan English Date: Fri, 10 Apr 2026 16:36:42 -0400 Subject: [PATCH] document var --- docs/language_overview.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/language_overview.md b/docs/language_overview.md index 19ce351..b4780f4 100644 --- a/docs/language_overview.md +++ b/docs/language_overview.md @@ -96,7 +96,9 @@ Exposing Sorel functions to C is also not currently supported, and Sorel _must_ * `+`, `-`, `*`, `/`, `%` (mod), `|` (bitwise OR) _(TODO add remaining operators)_ * Arithmetic operators. Pop two values off the stack and operate on them in the order they're added to the stack. Push the result back onto the stack. * `sys0`, `sys1`, `sys2`, ..., `sys6` - * Make a system call. The number in the word indicates the number of arguments. Call this the same way you'd call an extern. + * Make a system call. The number in the word indicates the number of arguments. Call this the same way you'd call an extern. System calls should generally be avoided outside of the stdlib code. +* `var` + * Declares a variable, whose identifier is the subsequent word. Variables are scoped to functions, and must be declared before they are used. They persist _forever_. When the identifier is used as a word after declaration, it puts a pointer to that variable onto the data stack. Variables should be used sparingly, in favour of using the data stack instead. In order to use `call`, you'll need to get a function pointer. These can be retrieved for a given function by prefixing it with an apostrophe `'`. -- 2.43.0