From 5e81613ac137c5641675ceb792ca105d345d98c6 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Thu, 14 Jul 2022 21:02:14 -0400 Subject: Handle transitive dependencies in REPL link code --- docs/doc/match.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/doc/match.html') diff --git a/docs/doc/match.html b/docs/doc/match.html index 13568805..d5cddee2 100644 --- a/docs/doc/match.html +++ b/docs/doc/match.html @@ -92,7 +92,7 @@ ⟨ 8 12 ⟩

These functions both have the definition {a×𝕩}, but give different results! They are different instances of the same block, and have different environments: for T2, a is 2, and for T3, it's 3.

-↗️
    t2 = t3
+↗️
    t2 = t3
 0
 

Some definitions should help to make things clearer. A "block" is not actually a BQN value, but a region of source code enclosed in {} brackets. When the program encounters a block function or modifier, it creates an instance of this block, and then uses this instance in the rest of the expression (actually, an immediate block also creates an instance, but this instance is immediately run, and discarded when it finishes, so it can't be accessed as a value). Every time the function Gen is run, it evaluates the statements it contains, and the second statement {a×𝕩} creates a block instance. So Gen creates a new block instance each time. This is necessary for Gen to work correctly: each time it runs, it creates a new scope, so it needs to create a new function that will be tied to that scope.

-- cgit v1.2.3