Lisp HUG Maillist Archive

Serious bug

Hi,

I have found a serious bug in LispWorks. Given the following  
definitions:

(in-package :cl-user)

(declaim (inline proceed))
(defun proceed (function)
   (funcall function))

(defmethod test (msg)
   (print msg))

(defmethod test :around (msg)
   (proceed #'call-next-method))

(defun run ()
   (test "Hello, World!"))

....when I type (run) in the listener, NIL is printed and is the  
return value. When I declaim (notinline proceed), "Hello, World" is  
correctly printed and returned.

I'm using LispWork 4.4.5 on Mac OS X 10.4.2.


Cheers,
Pascal

-- 
OOPSLA'05 tutorial on generic functions & the CLOS Metaobject Protocol
++++ see http://p-cos.net/oopsla05-tutorial.html for more details ++++

Pascal Costanza, mailto:pc@p-cos.net, http://p-cos.net
Vrije Universiteit Brussel, Programming Technology Lab
Pleinlaan 2, B-1050 Brussel, Belgium




Re: Serious bug

Hello Pascal,

| I have found a serious bug in LispWorks. Given the following
| definitions:
| 
| (in-package :cl-user)
| 
| (declaim (inline proceed))
| (defun proceed (function)
|    (funcall function))
| 
| (defmethod test (msg)
|    (print msg))
| 
| (defmethod test :around (msg)
|    (proceed #'call-next-method))
| 
| (defun run ()
|    (test "Hello, World!"))
| 
| ...when I type (run) in the listener, NIL is printed and is the
| return value. When I declaim (notinline proceed), "Hello, World" is
| correctly printed and returned.
| 
| I'm using LispWork 4.4.5 on Mac OS X 10.4.2.

Is it safe to invoke call-next-method from outside the lexical scope of
defmethod body? What is your interpretation of the following excerpt
form CLHS:
  The function call-next-method can be used within the body forms
  (but not the lambda list) of a method defined by a method-defining
  form to call the next method
?
--
Sincerely,
Dmitriy Ivanov
lisp.ystok.ru


Re: Serious bug

"Dmitriy Ivanov" <divanov@aha.ru> writes:

> Is it safe to invoke call-next-method from outside the lexical scope of
> defmethod body? 

I think it's not (I actually worked on a program that needed this some
while ago, and interpreted the spec as not allowing to treat
call-next-method as a normal function).

But you can achieve the desired effect by a lexical closure. By
changing test to:

(defmethod test :around (msg)
  (proceed (lambda()(call-next-method))))

the example will work as intended.

-- 
  (espen)


Re: Serious bug

Unable to parse email body. Email id is 4551

Updated at: 2020-12-10 08:50 UTC