summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-11-16 05:32:47 -0800
committerKaz Kylheku <kaz@kylheku.com>2016-11-16 05:32:47 -0800
commitcf0ac2826bc7dc06d3c63e956ec8922a358f4f80 (patch)
tree50063036810b493a2bca9d5892ea992f02d82360 /share
parent704664e60d7d548d9ce5c44b34d0d2b60db1e31c (diff)
downloadtxr-cf0ac2826bc7dc06d3c63e956ec8922a358f4f80.tar.gz
txr-cf0ac2826bc7dc06d3c63e956ec8922a358f4f80.tar.bz2
txr-cf0ac2826bc7dc06d3c63e956ec8922a358f4f80.zip
Start of fallback package list implementation.
* eval.c (eval_init): Register package-fallback-list and set-package-fallback-list intrinsics. * lib.c (package_fallback_list, set_package_fallback_list, intern_fallback): New functions * lib.h (package_fallback_list, set_package_fallback_list, intern_fallback): Declared. * parser.y (sym_helper): Slightly restructure function so that the symbol interning is done separately in the various cases. In the unqualified symbol case, use intern_fallback to search the fallback list of the current package. * share/txr/stdlib/package.tl (defpackage): Implement :fallback clause.
Diffstat (limited to 'share')
-rw-r--r--share/txr/stdlib/package.tl3
1 files changed, 3 insertions, 0 deletions
diff --git a/share/txr/stdlib/package.tl b/share/txr/stdlib/package.tl
index 7e62b6e5..12a8cf5e 100644
--- a/share/txr/stdlib/package.tl
+++ b/share/txr/stdlib/package.tl
@@ -68,6 +68,9 @@
(unless (eq (symbol-package s) ,pkg)
(unuse-sym s ,pkg)
(intern n ,pkg))))))
+ (:fallback
+ (if rest ^((set-package-fallback-list ,pkg
+ ',rest))))
(:use-from
(throwf 'eval-error
"~s: :use-from clause needs package argument"