From bada505b8d75ea65976b919fc740f53ea338f8d9 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sun, 4 Apr 2021 07:58:11 -0700 Subject: doc: note about environment handling in compile. * txr.1: Add notes about environment handling when an interpreted function is compiled, and how hlet/hlet* can be used to obtain sharing. --- txr.1 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'txr.1') diff --git a/txr.1 b/txr.1 index 1be7a991..df893a07 100644 --- a/txr.1 +++ b/txr.1 @@ -75474,12 +75474,22 @@ If the argument is a lambda expression, then that function is compiled. If the argument is a function object, and that object is an interpreted -function, then its code is retrieved and compiled. +function, then its code and lexical environment are retrieved and compiled. In all cases, the return value of .code compile is the compiled function. +Note: when an interpreted function object is compiled, the compiled environment +does not share bindings with the original interpreted environment. +Modifications to the bindings of either environment have no effect on the +other. However, the objects referenced by the bindings are shared. Shared +bindings may be arranged using the +.code hlet +or +.code hlet* +macros. + .coNP Functions @ compile-file and @ compile-update-file .synb .mets (compile-file < input-path <> [ output-path ]) -- cgit v1.2.3