diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-07-07 06:18:44 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-07-07 06:18:44 -0700 |
commit | 6b19d7b44fdf94409db7bdc0299210aa32d819fa (patch) | |
tree | 2f0105e151f8041c93b33aaa88397c139f2da59e /txr.1 | |
parent | f479570dd53f19123db9aa6d982d4bc08574bc65 (diff) | |
download | txr-6b19d7b44fdf94409db7bdc0299210aa32d819fa.tar.gz txr-6b19d7b44fdf94409db7bdc0299210aa32d819fa.tar.bz2 txr-6b19d7b44fdf94409db7bdc0299210aa32d819fa.zip |
doc: fix call-super-fun error and add example.
* txr.1: call-super-fun method intro paragraph wrongly refers
to call-super-method. Adding example about how to call a base
class method.
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 24 |
1 files changed, 23 insertions, 1 deletions
@@ -24375,7 +24375,7 @@ not to the type against which the calling method is defined. .syne .desc The -.code call-super-method +.code call-super-fun retrieves the function stored in the slot .meta name of the supertype of @@ -24395,6 +24395,28 @@ must name a static slot of that structure type. The object retrieved from that static slot must be callable as a function, and accept the arguments. +.TP* Example: + +Print a message and call supertype method: + +.cblk + (defstruct base nil) + + (defstruct derived base) + + (defmeth base fun (obj arg) + (format t "base fun method called with arg ~s\en" arg)) + + (defmeth derived fun (obj arg) + (format t "derived fun method called with arg ~s\en" arg) + (call-super-fun 'derived 'fun obj arg)) + + ;; Interactive Listener: + 1> (new derived).(fun 42) + derived fun method called with arg 42 + base fun method called with arg 42 +.cble + .coNP Macro @ with-objects .synb .mets (with-objects >> ({( sym << init-form )}*) << body-form *) |