Strange error in CLISP

Discussion of Common Lisp

Strange error in CLISP

Postby blandest » Fri Jan 23, 2009 9:16 am

I'm running the following code in CLISP:

Code: Select all
(defun test ()
   (format t "~A"))
(compile 'test) ;; this is required to reproduce the error

When running #'test without compiling it first, the error is (obviously): There are not enough arguments left for this format directive.
After compiling, the error is somehow lost and I get this strange message: APPLY: too few arguments given to #<COMPILED-FUNCTION TEST-1>
Also, evaluating (test 1) breaks into the debugger with the message: EVAL: too many arguments given to TEST: #1=(TEST 1)
So it seems impossible to call this function because any number of parameters will be wrong.

I've run this test on Windows with and without SLIME and using SBCL too. Only CLISP has this problem. I find this behavior annoying because I'm losing the useful error message. Is this a bug or am I doing something stupid ? :)
Posts: 19
Joined: Mon Jun 30, 2008 1:22 am

Re: Strange error in CLISP

Postby Ramarren » Fri Jan 23, 2009 9:45 am

I believe that compiling in CLISP should be done only with already debugged code, since compiling loses most information leading to cryptic errors, like the one you describe. What happens here I think is (format ...) getting compiled to local function of one argument TEST-1, which is different from top level function TEST, and so you get an error about that one.

CLISP is a bytecode interpreter, though there is a JIT now, I heard... but somehow I doubt it works on Windows well or at all. This means that most of the time compilation doesn't really give that much performance. SBCL is primarily a compiler, and its static checking is much better.
Posts: 613
Joined: Sun Jun 29, 2008 4:02 am
Location: Warsaw, Poland

Return to Common Lisp

Who is online

Users browsing this forum: No registered users and 2 guests