diff options
-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 *) |