summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-10-31 06:49:22 -0700
committerKaz Kylheku <kaz@kylheku.com>2016-10-31 06:49:22 -0700
commitf6ca45e5586325bc41635295eb68f05960ebba15 (patch)
treea80e4d82757e2385fa731f4fc07beb362e41d7d9 /eval.c
parent0cc2bdc5bcd8707185961f07d117df62f137d5ec (diff)
downloadtxr-f6ca45e5586325bc41635295eb68f05960ebba15.tar.gz
txr-f6ca45e5586325bc41635295eb68f05960ebba15.tar.bz2
txr-f6ca45e5586325bc41635295eb68f05960ebba15.zip
Relax restrictions on dwim places.
No longer require the leftmost expression in a dwim place to itself be a place, except when the expression evaluates to a list, and the list is subject to an element deletion or a range operation. * eval.c (eval_init): Register dwim-set and dwim-del with one additional argument that the C functions now take. * lib.c (dwim_set, dwim_del): Take a new place_p argument which informs these functions whether the object they are operating on came from a syntactic place. The forbidden situations are diagnosed based on this flag: modification of the subrange of a list, or deletion of a list ref. Some error messages reworded. * lib.h (dwim_set, dwim_del): Declarations updated. * share/txr/stdlib/place.tl (defplace dwim): Produce a
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/eval.c b/eval.c
index d6a52f86..389efdf2 100644
--- a/eval.c
+++ b/eval.c
@@ -5347,8 +5347,8 @@ void eval_init(void)
reg_fun(intern(lit("ref"), user_package), func_n2(ref));
reg_fun(intern(lit("refset"), user_package), func_n3(refset));
reg_fun(intern(lit("replace"), user_package), func_n4o(replace, 2));
- reg_fun(intern(lit("dwim-set"), system_package), func_n1v(dwim_set));
- reg_fun(intern(lit("dwim-del"), system_package), func_n2(dwim_del));
+ reg_fun(intern(lit("dwim-set"), system_package), func_n2v(dwim_set));
+ reg_fun(intern(lit("dwim-del"), system_package), func_n3(dwim_del));
reg_fun(intern(lit("update"), user_package), func_n2(update));
reg_fun(intern(lit("search"), user_package), func_n4o(search, 2));
reg_fun(intern(lit("rsearch"), user_package), func_n4o(rsearch, 2));