diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-07-07 06:39:47 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-07-07 06:39:47 -0700 |
commit | 10d16b5da0b45265d669f061db6f4457c4661811 (patch) | |
tree | e83cf25c967e986b4f907a096263355411bf44c7 | |
parent | 6b19d7b44fdf94409db7bdc0299210aa32d819fa (diff) | |
download | txr-10d16b5da0b45265d669f061db6f4457c4661811.tar.gz txr-10d16b5da0b45265d669f061db6f4457c4661811.tar.bz2 txr-10d16b5da0b45265d669f061db6f4457c4661811.zip |
doc: mention syntax for calling methods.
* txr.1: The recommendation to use call-super-fun is rounded
out by mentioning that the (meth ...) syntax can achieve the
same thing. An example of it is added under call-super-fun.
-rw-r--r-- | txr.1 | 23 |
1 files changed, 21 insertions, 2 deletions
@@ -23725,9 +23725,14 @@ from .code copy will call the most derived override of that method. -A derived method can use the +To call the corresponding method in the base class, a given derived method +can use the .code call-super-fun -to call the corresponding method in the base class. +function, or else the +.code "(meth ...)" +syntax in the first position of a compound form, in place of a function name. +Examples of both are given in the documentation for +.codn call-super-fun . Thus derived structs can inherit the copy handling logic from base structs, and extend it with their own. @@ -24417,6 +24422,20 @@ Print a message and call supertype method: base fun method called with arg 42 .cble +Note that a static method or function in any structure type +can be invoked by using the +.code "(meth ...)" +name syntax in the first position of a compound form, as +a function name. Thus, the above +.code "derived fun" +can also be written: + +.cblk + (defmeth derived fun (obj arg) + (format t "derived fun method called with arg ~s\en" arg) + ((meth base fun) obj arg)) +.cble + .coNP Macro @ with-objects .synb .mets (with-objects >> ({( sym << init-form )}*) << body-form *) |