7 Jun 14:00
CLOS keeps on surprising me
From: Toomas Altosaar <Toomas.Altosaar@...>
Subject: CLOS keeps on surprising me
Newsgroups: gmane.lisp.mcl.general
Date: 2008-06-07 12:00:23 GMT
Subject: CLOS keeps on surprising me
Newsgroups: gmane.lisp.mcl.general
Date: 2008-06-07 12:00:23 GMT
Would have thought that the following would have been caught at compile time.
But I imagine that there is a good reason for only detecting this at run time.
This in 5.1b4.
-----
(defgeneric some-function (x)
(:method (x) (print x) (values))
(:method :before (x) (print :before))
(:method :after (x) (print :after))
(:method :around (x)
(print :around1)
(call-next-method)
(print :around2)
(values))
(:method :BULL (x)
(print :BULL)))
;(some-function 5)
> Error: #<STANDARD-METHOD SOME-FUNCTION :BULL (T)> is an invalid method.
> :BULL is not one of :BEFORE, :AFTER, and :AROUND.
> While executing: CCL::%INVALID-METHOD-ERROR
> Type Command-. to abort.
See the Restarts menu item for further choices.
1 >
;(COMPUTE-APPLICABLE-METHODS #'some-function '(5)) ==>
(#<STANDARD-METHOD SOME-FUNCTION (T)>
#<STANDARD-METHOD SOME-FUNCTION :AFTER (T)>
#<STANDARD-METHOD SOME-FUNCTION :AROUND (T)>
#<STANDARD-METHOD SOME-FUNCTION :BEFORE (T)>
#<STANDARD-METHOD SOME-FUNCTION :BULL (T)>)
_______________________________________________
info-mcl mailing list
info-mcl@...
http://clozure.com/mailman/listinfo/info-mcl
RSS Feed