[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Argument precedence order
Either I misunderstand :argument-precedence-order in CLOS or there is
a bug in Genera 8.1.1:
(defclass 1aaa 0()
())
(defclass 1bbb 0(aaa)
())
(setq aaa-thing (make-instance 'aaa))
(setq bbb-thing (make-instance 'bbb))
(defgeneric 1foo 0(y z)
(:method ((y bbb) z)
"bbb on first arg")
(:method (y (z aaa))
"aaa on second arg"))
(defgeneric 1bar 0(y z)
(:argument-precedence-order z y)
(:method ((y bbb) z)
"bbb on first arg")
(:method (y (z aaa))
"aaa on second arg"))
then both foo and bar do the same thing:
(foo bbb-thing aaa-thing) -> "bbb on first arg"
(bar bbb-thing aaa-thing) -> "bbb on first arg"
(compute-applicable-methods (symbol-function 'foo) (list bbb-thing aaa-thing)) ->
(#<STANDARD-METHOD FOO (BBB T) 74021445> #<STANDARD-METHOD FOO (T AAA) 74021463>)
(compute-applicable-methods (symbol-function 'bar) (list bbb-thing aaa-thing)) ->
(#<STANDARD-METHOD BAR (BBB T) 74013237> #<STANDARD-METHOD BAR (T AAA) 74013255>)
I was hoping that the second method ("aaa on second arg") was applied when bar was
called. Isn't that what :argument-precedence-order is all about?
(Apologies if this is more appropriate for comp.lang.clos; my posting access
is kaput.)
================================================================================
Liam M. Healy
Code 8242, Naval Research Laboratory, Washington, DC 20375
Telephone: 202-404-8338
Internet: Healy@space50.nrl.navy.mil
Composed on 3/12/92 18:22:16 at SPACE20 (a Symbolics 3620)