#643 CLISP treats CL:REQUIRE specially at compile time

lisp error
open
Bruno Haible
clisp (525)
5
2012-05-10
2012-05-10
Zach Beane
No

I have a file "test.lisp" that contains only this:

(require 'bogus)

When I start "clisp -ansi -norc" and issue (compile-file "test.lisp"), I get this:

[1]> (compile-file "test.lisp")
;; Compiling file /home/xach/test.lisp ...
*** - LOAD: A file with name BOGUS does not exist
The following restarts are available:
ABORT :R1 Abort main loop
Break 1 [2]> :bt
<1/574> #<SYSTEM-FUNCTION SHOW-STACK> 3
<2/567> #<COMPILED-FUNCTION SYSTEM::PRINT-BACKTRACE>
<3/561> #<COMPILED-FUNCTION SYSTEM::DEBUG-BACKTRACE>
<4/552> #<SYSTEM-FUNCTION SYSTEM::READ-EVAL-PRINT> 2
<5/549> #<COMPILED-FUNCTION SYSTEM::BREAK-LOOP-2-3>
<6/545> #<SYSTEM-FUNCTION SYSTEM::SAME-ENV-AS> 2
<7/531> #<COMPILED-FUNCTION SYSTEM::BREAK-LOOP-2>
<8/529> #<SYSTEM-FUNCTION SYSTEM::DRIVER>
<9/489> #<COMPILED-FUNCTION SYSTEM::BREAK-LOOP>
<10/486> #<SYSTEM-FUNCTION INVOKE-DEBUGGER> 1
<11/481> #<SYSTEM-FUNCTION SYSTEM::ERROR-OF-TYPE>
<12/457> #<COMPILED-FUNCTION LOAD>
<13/443> #<COMPILED-FUNCTION SYSTEM::SIMPLE-REQUIRE>
<14/438> #<COMPILED-FUNCTION REQUIRE>
<15/430> #<COMPILED-FUNCTION SYSTEM::LOAD-OR-COMPILE>
<16/425> #<COMPILED-FUNCTION SYSTEM::C-REQUIRE>
[422] EVAL frame for form (SYSTEM::C-REQUIRE 'BOGUS)
<17/419> #<SPECIAL-OPERATOR PROGN>
[418] EVAL frame for form (PROGN (SYSTEM::C-REQUIRE 'BOGUS))
<18/410> #<SYSTEM-FUNCTION EVAL>
<19/408> #<COMPILED-FUNCTION SYSTEM::C-EVAL-AND-WRITE-LIB>
[406] EVAL frame for form (SYSTEM::C-EVAL-AND-WRITE-LIB '(PROGN (SYSTEM::C-REQUIRE 'BOGUS)))
<20/403> #<SPECIAL-OPERATOR PROGN>
[402] EVAL frame for form (PROGN (SYSTEM::C-EVAL-AND-WRITE-LIB '(PROGN (SYSTEM::C-REQUIRE 'BOGUS))))
<21/394> #<SYSTEM-FUNCTION EVAL>
<22/387> #<COMPILED-FUNCTION SYSTEM::C-EVAL-WHEN>
<23/365> #<COMPILED-FUNCTION SYSTEM::C-FORM>
<24/343> #<COMPILED-FUNCTION SYSTEM::C-FORM>
<25/340> #<COMPILED-FUNCTION SYSTEM::C-GLOBAL-FUNCTION-CALL>
<26/319> #<COMPILED-FUNCTION SYSTEM::C-FORM>
<27/315> #<COMPILED-FUNCTION SYSTEM::C-PROGN>
<28/294> #<COMPILED-FUNCTION SYSTEM::C-FORM>
<29/207> #<COMPILED-FUNCTION SYSTEM::C-LAMBDABODY>
<30/198> #<COMPILED-FUNCTION SYSTEM::COMPILE-LAMBDABODY>
<31/186> #<COMPILED-FUNCTION SYSTEM::COMPILE-TOPLEVEL-FORM>
<32/42> #<COMPILED-FUNCTION COMPILE-FILE>
[34] EVAL frame for form (COMPILE-FILE "test.lisp")
Printed 32 frames

I am using 64-bit Linux. I get this error with CLISP 2.49 and CLISP from Mercurial.

Since REQUIRE is a function, I expected the error at runtime (when loading the file or its fasl), not at compile-time.

Discussion

  • Zach Beane
    Zach Beane
    2012-05-10

    Well, duh, I now see this is documented in the manual. However, this causes a problem for a real program that does (ignore-errors (require 'asdf)) in an attempt to load the "system" ASDF if it is available. Since REQUIRE is eagerly evaluated at compile time, the error isn't ignored as it should be.

    Any suggestions?