3 ms·
Note to galaxylogic: When lispm wrote: (defmethod foo ((p person) (s string)) (list p s)) He was implicitly defining a "generic func
by flavio81 8y ago
Note to galaxylogic: When lispm wrote:
(defmethod foo ((p person) (s string))
(list p s))
He was implicitly defining a "generic function" "foo" of two arguments.
Defmethod was defining an implementation of the generic function foo for arguments person with string.
One could later put something like:
(defmethod foo ((p person) (p person))
(send-greeting p p))
And thus define a "foo" that works on two persons, etc.
CLOS allows specializing not just on classes, but also on specific instances, so some method applies only for a specific instance. For example a "foo" that applies only to a particular "important" person.