From 10d16b5da0b45265d669f061db6f4457c4661811 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 7 Jul 2017 06:39:47 -0700 Subject: 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. --- txr.1 | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/txr.1 b/txr.1 index 4c0abd76..11b1ece9 100644 --- a/txr.1 +++ b/txr.1 @@ -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 *) -- cgit v1.2.3