summaryrefslogtreecommitdiffstats
path: root/protsym.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2018-05-01 20:17:57 -0700
committerKaz Kylheku <kaz@kylheku.com>2018-05-01 20:17:57 -0700
commit771499a17a7d6dcdc962e74201d7ee0ffa8d9f87 (patch)
treef0b2c6e4ab664aa1098c8350512f902a6effb40e /protsym.c
parentc56d0c84dfe150f5dfe513be2dd9ce105684404b (diff)
downloadtxr-771499a17a7d6dcdc962e74201d7ee0ffa8d9f87.tar.gz
txr-771499a17a7d6dcdc962e74201d7ee0ffa8d9f87.tar.bz2
txr-771499a17a7d6dcdc962e74201d7ee0ffa8d9f87.zip
interpreter: correct semantics of special var args.
In this patch we eliminate the special operator sys:with-dyn-rebinds, and implement correct semantics for dynamically scoped variables that occur in argument lists. * eval.c (with_dyn_rebinds_s): Symbol variable removed. (bind_args): Handle special variables dynamically: for each symbol that appears, check whether it is a special and treat accordingly by allocating a new dynamic environment if necessary, and binding in that environment. This adds overhead, which is why I moved away from this approach in the past. But now that there is a compiler, overhead in the interpreter matters less. Correct semantics is more important. (expand_params): Greatly simplified for not having to wrap the sys:with-dyn-rebinds operator around the body. (funcall_interp): Since bind_args can now extend the dynamic environment, it is necessary to save and restore dyn_env around it. Another call to bind_args occurs in op_catch; that already saves and restores dyn_env. (op_with_dyn_rebinds): Static function removed. (do_expand): with-dyn-rebinds-s case removed. (eval_init): Removed interning of sys:with-dyn-rebinds symbol and registration of special op. * protsym.c: Regenerated. * compiler.tl (compiler compile): Remove case which handles sys:with-dyn-rebinds.
Diffstat (limited to 'protsym.c')
-rw-r--r--protsym.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/protsym.c b/protsym.c
index 5c0db635..87e2ff42 100644
--- a/protsym.c
+++ b/protsym.c
@@ -128,9 +128,9 @@ extern val ushort_s, uw_protect_s, val_s, var_k, var_s;
extern val vars_k, vec_list_s, vec_s, vecref_s, vector_lit_s;
extern val vm_closure_s, vm_desc_s, void_s, warning_s, wchar_s;
extern val weak_keys_k, weak_vals_k, when_s, while_s, while_star_s;
-extern val whole_k, wild_s, with_dyn_rebinds_s, word_char_k, wrap_k;
-extern val wstr_d_s, wstr_s, year_s, zap_s, zarray_s;
-extern val zeroplus_s, zone_s;
+extern val whole_k, wild_s, word_char_k, wrap_k, wstr_d_s;
+extern val wstr_s, year_s, zap_s, zarray_s, zeroplus_s;
+extern val zone_s;
#if CONFIG_DEBUG_SUPPORT
extern val debug_quit_s;
@@ -259,9 +259,9 @@ val *protected_sym[] = {
&vars_k, &vec_list_s, &vec_s, &vecref_s, &vector_lit_s,
&vm_closure_s, &vm_desc_s, &void_s, &warning_s, &wchar_s,
&weak_keys_k, &weak_vals_k, &when_s, &while_s, &while_star_s,
- &whole_k, &wild_s, &with_dyn_rebinds_s, &word_char_k, &wrap_k,
- &wstr_d_s, &wstr_s, &year_s, &zap_s, &zarray_s,
- &zeroplus_s, &zone_s,
+ &whole_k, &wild_s, &word_char_k, &wrap_k, &wstr_d_s,
+ &wstr_s, &year_s, &zap_s, &zarray_s, &zeroplus_s,
+ &zone_s,
#if CONFIG_DEBUG_SUPPORT
&debug_quit_s,