summaryrefslogtreecommitdiffstats
path: root/txr.1
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2023-05-16 06:34:31 -0700
committerKaz Kylheku <kaz@kylheku.com>2023-05-16 06:34:31 -0700
commitc990d37be74f452d1a8bcb2b0b1dc133704c0a93 (patch)
treebef4d7e94d53353d5e8fa17b3946874c16d1f7fd /txr.1
parentc606261b92348ef7b0f934705ee46ee4ccf28bab (diff)
downloadtxr-c990d37be74f452d1a8bcb2b0b1dc133704c0a93.tar.gz
txr-c990d37be74f452d1a8bcb2b0b1dc133704c0a93.tar.bz2
txr-c990d37be74f452d1a8bcb2b0b1dc133704c0a93.zip
New special operator: compiler-let
* eval.c (compiler_let_s): New symbol variable. (op_let): Recognize compiler-let for sequential binding. (do_expand): Traverse and diagnose compiler-let form. (eval_init): Initialize compiler_let_s and register the interpreted version of the operator. * stdlib/compiler.tl (compiler compile): Handle compiler-let form. (compiler comp-compiler-let): New method. (no-dvbind-eval): New function. * autoload.c (compiler-set-entries): Intern the compiler-let symbol in the user package. * txr.1: Documented. * stdlib/doc-syms.tl: Updated.
Diffstat (limited to 'txr.1')
-rw-r--r--txr.149
1 files changed, 49 insertions, 0 deletions
diff --git a/txr.1 b/txr.1
index 539c95b2..e8cbfc60 100644
--- a/txr.1
+++ b/txr.1
@@ -88206,6 +88206,55 @@ with unused variable checking enabled.
(compile-file "bar.tl"))
.brev
+.coNP Operator @ compiler-let
+.synb
+.mets (compiler-let >> ({ sym | >> ( sym << init-form )}*) << body-form *)
+.syne
+.desc
+The
+.code compiler-let
+operator strongly resembles
+.code let*
+but has different semantics, relevant to compilation.
+
+Symbols bound using
+.code compiler-let
+are expected to be special variables. For every
+.metn sym ,
+the expression
+.mono
+.meti (special-var-p << sym )
+.onom
+should be true. The behavior is unspecified for any
+.meta sym
+which doesn't name a special variable.
+
+When the compiler encounters the
+.code compiler-let
+construct, the compiler itself establishes a dynamic scope in which the
+implied special variable bindings are in effect. This effect is not
+incorporated into the compiled code. The compiler then implicitly places the
+.metn body-form s,
+into a
+.code progn
+from, and compiles that form. While the implicit
+.code progn
+is being compiled, the dynamic bindings established by
+.code compiler-let
+are in scope.
+
+Thus
+.code compiler-let
+may be used to bind special variables which influence compiler behavior.
+
+The
+.code compiler-let
+form is treated like
+.code let*
+by the interpreter, provided that every
+.meta sym
+names a special variable.
+
.coNP Macro @ load-time
.synb
.mets (load-time << form )