[Openmcl-devel] Openmcl/SLIME problem

Takehiko Abe keke at gol.com
Fri Feb 29 01:44:56 UTC 2008


Neil Baylis wrote:

> I run into a problem when running SLIME with Clozure Common Lisp
> (a.k.a.  openmcl).
>
> When I call a function with the wrong number of args, the error
> message is unhelpful. When I do the same running openmcl directly
> (not via SLIME) it works correctly. Here's a transcript:

I tried the same and it appeared to work correctly. However,

;; Welcome to Clozure Common Lisp Version 1.1-r (LinuxX8664)!
;; ? (defun foo (a b) (+ a b))
;; FOO
;; ? (foo 1)
;; > Error: Too few arguments in call to #<Compiled-function FOO
;; >        1 arguments provided, at least 2 required.
;; > While executing: FOO, in process listener(1).
;; > Type :POP to abort, :R for a list of available restarts.
;; > Type :? for other options.
;; 1> (:f 0)
;; (2AAAAACBBAC0) : 0 (FOO ? ?) 15#<error printing args and locals>

Note the #<error printing args and locals>.

Slime tries to print this "args and locals" and that triggers an
error in openmcl.

The error is signaled in ccl::arguments-and-locals:

;; ; SLIME 2007-06-28
;; CL-USER> (defun foo (a b) (+ a b))
;; FOO
;; CL-USER> (foo 1)
;; > Error: value -2 is not of the expected type UNSIGNED-BYTE.
;; > While executing: NBUTLAST, in process repl-thread(5).
;; > Type :POP to abort, :R for a list of available restarts.
;; > Type :? for other options.
;; 1> :b
;;
;; (2AAAABD47098) : 0 (NBUTLAST NIL [...]) 237
;; (2AAAABD470E0) : 1 (ARGUMENTS-AND-LOCALS
;;                      NIL
;;                      5864064454420
;;                      #<Compiled-function FOO #x30004104FE6F>
;;                      15
;;                      [...]) 1085

NBUTLAST is called with (nil -2) because ccl::variables-in-scope
returns nil:

(defun arguments-and-locals (context cfp lfun pc &optional unavailable)
   (multiple-value-bind (vars map-indices) (variables-in-scope lfun pc)
     (collect ((args)
	      (locals))
       (multiple-value-bind (valid req opt rest keys)
			   (arg-names-from-map lfun pc)
	(when valid
	  (let* ((nargs (+ (length req) ...))
		 (nlocals (- (length vars) nargs))
		 (local-vars (nthcdr nargs vars))
		 (local-indices (nthcdr nargs map-indices))
		 (arg-vars (nbutlast vars nlocals))
		 (arg-indices (nbutlast map-indices nlocals)))
	    ...




More information about the Openmcl-devel mailing list