From 0f544070713a7dd93aa759dd71cf02fadd05814c Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 31 Dec 2016 20:37:37 -0800 Subject: Bugfix: repeated expansion of catch unstable. It turns out we have a silly problem: catch is a special operator, which undergoes a macro-like expansion which alters its syntax, but uses the same operator symbol. We turn catch into a macro which expands to a sys:catch operator. * eval.c (sys_catch_s): New symbol variable. (expand_catch): Function now expands sys:catch forms without altering any syntax. (do_expand): Check for sys:catch rather than catch. Call expand_catch differently: it takes the form now instead of just the arguments, so it can return the original form if no expansion takes place. (eval_init): Initialize sys_catch_s variable. Change registration of op_catch to sys:catch symbol. * lisplib.c (except_set_entries): Add catch to the list of autoload symbols for except.tl. * share/txr/stdlib/except.tl (catch): New macro for transforming catch to sys:catch. * txr.1: Reclassify catch operator as a macro. --- txr.1 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'txr.1') diff --git a/txr.1 b/txr.1 index 4f8e52ef..90d580e4 100644 --- a/txr.1 +++ b/txr.1 @@ -32246,7 +32246,7 @@ A is found which matches the exception, and control is transferred to the catch. Catches are defined by the .code catch -operator. +macro. .IP - A handler accepts the exception by performing a non-local transfer. Handlers are defined by the @@ -32415,7 +32415,7 @@ has the same semantics as .codn handler-bind , providing only convenient syntax. -\*(TL provides an operator called +\*(TL provides a macro called .code catch which has the same syntax as .code handle @@ -32425,7 +32425,7 @@ clause matches an exception, a dynamic control transfer takes place from the throw site to the catch site. Then the clause body is executed. The .code catch -operator resembles ANSI CL's +macro resembles ANSI CL's .code restart-case or possibly .codn handler-case , @@ -32551,7 +32551,7 @@ using the .code format string and additional arguments. -.coNP Operator @ catch +.coNP Macro @ catch .synb .mets (catch < try-expression .mets \ \ >> {( symbol <> ( arg *) << body-form *)}*) @@ -32559,7 +32559,7 @@ string and additional arguments. .desc The .code catch -operator establishes an exception catching block around +macro establishes an exception catching block around the .metn try-expression . The -- cgit v1.2.3