diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2022-10-03 22:10:32 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2022-10-03 22:10:32 -0700 |
commit | 9c1e2974fad18576c0051d046f03d799d2879fdc (patch) | |
tree | f67f60de1965f70ec4c717486ef4b88871e61ad1 /METALICENSE | |
parent | 502543ea94913ec4d4792dbd07151fba22220637 (diff) | |
download | txr-9c1e2974fad18576c0051d046f03d799d2879fdc.tar.gz txr-9c1e2974fad18576c0051d046f03d799d2879fdc.tar.bz2 txr-9c1e2974fad18576c0051d046f03d799d2879fdc.zip |
New: %fun% mechanism for current function name.
* eval.c (pct_fun_s): New symbol variable, holding
the usr:%fun% symbol.
(fun_macro_env): New static function.
(do_expand): For defun and defmacro, use fun_macro_env
to establish an environment binding the %fun% symbol
macro, and expand everything in that environment.
(eval_init): Intern the %fun% symbol, initializing
pct_fun_s, and also register a global symbol macro in
that name so that we can freely use %fun% everywhere
without worrying that the code will blow up.
E.g. a logging macro can use it to get the function name,
but still be useful in a top-level form outside of
a named function.
* stdlib/struct.tl (sys:meth-lambda): New macro.
(defstruct, defmeth): Use sys:meth-lambda as a replacement
for lambda to set up the %fun% symbol macro. In the :init
case which doesn't use a lambda, an open-coded symacrolet
does the job.
* tests/019/pct-fun.tl: New file.
* tests/019/pct-fun.expected: Likewise.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
Diffstat (limited to 'METALICENSE')
0 files changed, 0 insertions, 0 deletions