diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-10-29 15:49:33 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-10-29 15:49:33 -0700 |
commit | adef4143af67eb8874e7013eb2c0b40da2099e5b (patch) | |
tree | f659e252eafbb0e6c074152c077e0c3f29491a57 /eval.c | |
parent | 8f19618313f5e1342177b8580575df5690195e8c (diff) | |
download | txr-adef4143af67eb8874e7013eb2c0b40da2099e5b.tar.gz txr-adef4143af67eb8874e7013eb2c0b40da2099e5b.tar.bz2 txr-adef4143af67eb8874e7013eb2c0b40da2099e5b.zip |
Extend symbol-function accessor to methods.
* eval.c (looup_fun): Handle (meth ...) syntax.
* share/txr/stdlib/place.tl (sys:get-fb): Function
removed.
(sys:get-fun-getter-setter): New function.
(defplace symbol-function): Rework getter and
setter using new function which works for method
as well as regular function bindings.
* txr.1: Documentation updated in several places.
The mention of symbol-function in the list of place
forms altered so it doesn't insinuate that the argument
must be a symbol. Description of symbol-function
updated. Also under the trace and untrace macros,
a note added that tracing methods is possible.
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -401,6 +401,14 @@ val lookup_fun(val env, val sym) uses_or2; if (nilp(env)) { + if (consp(sym) && car(sym) == meth_s) { + val strct = cadr(sym); + val slot = caddr(sym); + val type = or2(find_struct_type(strct), + if2(lisplib_try_load(strct), + find_struct_type(strct))); + return if2(type, cons(sym, static_slot(type, slot))); + } return or2(gethash(top_fb, sym), if2(lisplib_try_load(sym), gethash(top_fb, sym))); } else { |