I'm trying to debug getting threads running on SBCL/x86/MacOS and in doing so I've come across a strange problem where something (presumably clim-desktop.asd) is requiring swank, which is causing swank.asd to get reloaded and swank-backend is getting recompiled, which causes current-thread to get redefined to 0. This seems to wreak havoc with some of the locking stuff, which presumably has various locks held while it's trying to output the results of the compilation. Should the definterface stuff in swank-backend have some sort of check to see if these haven't been previously implemented before overwriting the previous method definitions?
Thanks,
Cyrus
On further examination, the problem is that swank-backend gets reloaded, causing the definterface forms to fire again, which overwrites the existing methods. The following patch checks to see if the symbol is fbounp before doing the defgeneric and gen-default-impl stuff.
Cyrus
--- swank-backend.lisp 20 Apr 2006 16:48:23 -0700 1.98 +++ swank-backend.lisp 21 May 2006 17:22:01 -0700 @@ -114,15 +114,16 @@ (check-type documentation string "a documentation string") (flet ((gen-default-impl () `(defmethod ,name ,args ,@default-body))) - `(progn (defgeneric ,name ,args (:documentation ,documentation)) - (pushnew ',name *interface-functions*) - ,(if (null default-body) - `(pushnew ',name *unimplemented-interfaces*) - (gen-default-impl)) - ;; see <http://www.franz.com/support/documentation/6.2/ doc/pages/variables/compiler/s_cltl1-compile-file-toplevel- compatibility-p_s.htm> - (eval-when (:compile-toplevel :load-toplevel :execute) - (export ',name :swank-backend)) - ',name))) + `(unless (fboundp ',name) + (progn (defgeneric ,name ,args (:documentation ,documentation)) + (pushnew ',name *interface-functions*) + ,(if (null default-body) + `(pushnew ',name *unimplemented-interfaces*) + (gen-default-impl)) + ;; see <http://www.franz.com/support/documentation/6.2/ doc/pages/variables/compiler/s_cltl1-compile-file-toplevel- compatibility-p_s.htm> + (eval-when (:compile-toplevel :load-toplevel :execute) + (export ',name :swank-backend)) + ',name)))) (defmacro defimplementation (name args &body body) `(progn (defmethod ,name ,args ,@body)
On May 21, 2006, at 5:10 PM, Cyrus Harmon wrote:
I'm trying to debug getting threads running on SBCL/x86/MacOS and in doing so I've come across a strange problem where something (presumably clim-desktop.asd) is requiring swank, which is causing swank.asd to get reloaded and swank-backend is getting recompiled, which causes current-thread to get redefined to 0. This seems to wreak havoc with some of the locking stuff, which presumably has various locks held while it's trying to output the results of the compilation. Should the definterface stuff in swank-backend have some sort of check to see if these haven't been previously implemented before overwriting the previous method definitions?
Thanks,
Cyrus
slime-devel site list slime-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/slime-devel
Cyrus Harmon ch-slime@bobobeach.com writes:
On further examination, the problem is that swank-backend gets reloaded, causing the definterface forms to fire again, which overwrites the existing methods. The following patch checks to see if the symbol is fbounp before doing the defgeneric and gen-default-impl stuff.
unfortunetly this makes it hard to work on slime (though i'll admit that executing the defimplementation forms multiple times doesn't happen much an more). maybe it'd be better to set some flag at after loading the file and test on that? if someone wants to work on slime they just turn that single flag off and continue as if nothing happened.
Marco Baringer mb@bese.it writes:
Cyrus Harmon ch-slime@bobobeach.com writes:
On further examination, the problem is that swank-backend gets reloaded, causing the definterface forms to fire again, which overwrites the existing methods. The following patch checks to see if the symbol is fbounp before doing the defgeneric and gen-default-impl stuff.
unfortunetly this makes it hard to work on slime (though i'll admit that executing the defimplementation forms multiple times doesn't happen much an more). maybe it'd be better to set some flag at after loading the file and test on that? if someone wants to work on slime they just turn that single flag off and continue as if nothing happened.
What about the attached patch, which makes DEFINTERFACE consistent with its documentation string?
Luke Gorrie removed the NO-APPLICABLE-METHOD stuff sometime in June 2004 (revision 1.59 of swank-backend.lisp) with a comment saying "N-A-M was a stupid idea", but in fact it's a pretty clever idea, I think, as it solves the problem of generic functions with no arguments.
Cheers,
Christophe
If I recall, I already answered you on c.l.l, as did a few others. Did you _try_ what was suggested?
CL-USER> (defvar *mark* nil) *MARK* CL-USER> (defmacro with-mark (&body forms) `(let ((*mark* t)) ,@forms)) WITH-MARK CL-USER> (defun markp () *mark*) MARKP CL-USER> (defun f () (markp)) F CL-USER> (with-mark (loop repeat 3 collect (f))) (T T T) CL-USER> (loop repeat 3 collect (f)) (NIL NIL NIL)
This is what you wanted, yes?
Cheers,
-- Nikodemus Schemer: "Buddha is small, clean, and serious." Lispnik: "Buddha is big, has hairy armpits, and laughs."