[slime-devel] Slime bug in macro handling

Will M. Farr farr at MIT.EDU
Fri Apr 29 17:43:04 UTC 2005

Hello all,

I have just encountered a bug while using SBCL or OpenMCL 
0.14.3 and the latest CVS slime (as of 10 minutes ago) on my PowerBook 
G4 with Mac OS 10.3.9.  Evaluating the following commands using C-M-x 
(except for the in-package, which I have to type at the REPL) works 

(defpackage :fast-math
   (:use :cl))

(in-package :fast-math)

(defmacro f+ (&rest xs)
   `(the double-float
      (+ ,@(map 'list #'(lambda (x) `(the double-float ,x)) xs))))

(defmacro f- (&rest xs)
   `(the double-float
      (- ,@(map 'list #'(lambda (x) `(the double-float ,x)) xs))))

(defmacro f* (&rest xs)
   `(the double-float
      (* ,@(map 'list #'(lambda (x) `(the double-float ,x)) xs))))

(defmacro f/ (&rest xs)
   `(the double-float
      (/ ,@(map 'list #'(lambda (x) `(the double-float ,x)) xs))))

(f* 10.d0 30.d0)
(f+ 10.d0 30.d0)
(f- 10.d0 30.d0)
(f/ 30.d0 10.d0)

However, if I then type

(f* 10.d0 30.d0)

at the REPL, I get an error involving the "undefined function f*".  
Even after this, if I then evaluate (f* 10.d0 30.d0) using C-M-x it 
works fine!  I notice that typing (f* ...) in the REPL doesn't bring up 
the autocomplete information from SLIME, while typing it in a different 
slime buffer does bring up the note (f* &rest xs).  The problem doesn't 
occur if the macros are defined in the cl-user package.

I don't really know anything about the internal workings of slime or 
I'd post a fix, too.  Sorry.

Let me know if there's more information I can offer about the problem.

Will Farr

More information about the slime-devel mailing list