From 9922628e2a0cc8e4b73952a3a0a4dd185aab1daf Mon Sep 17 00:00:00 2001 From: Ryan Daum Date: Sun, 11 Feb 2024 10:12:43 -0500 Subject: [PATCH] Add a TODO (and issue) for lexical scoping extension for the MOO language --- crates/kernel/src/vm/activation.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/crates/kernel/src/vm/activation.rs b/crates/kernel/src/vm/activation.rs index 29efe4b83..f5ebaa762 100644 --- a/crates/kernel/src/vm/activation.rs +++ b/crates/kernel/src/vm/activation.rs @@ -68,6 +68,18 @@ pub(crate) struct Frame { pub(crate) program: Program, /// The program counter. pub(crate) pc: usize, + // TODO: Language enhancement: Introduce lexical scopes to the MOO language: + // add a 'with' keyword to the language which introduces a new scope, similar to ML's "let": + // with x = 1 in + // ... + // endlet + // Multiple variables can be introduced at once: + // with x = 1, y = 2 in ... + // Variables not declared with 'with' are verb-scoped as they are now + // 'with' variables that shadow already-known verb-scoped variables override the verb-scope + // Add LetBegin and LetEnd opcodes to the language. + // Make the environment have a width, and expand and contract as scopes are entered and exited. + // Likewise, Names in Program should be scope delimited somehow /// The values of the variables currently in scope, by their offset. pub(crate) environment: BitArray>, /// The value stack.