Colin McDonnell
Colin McDonnell

Reputation: 971

Type Error when compiling SBCL defun in Aquamacs with SLIME

This is the function I'm trying to compile. It's the only thing in the lisp file as well.

    (defun hello-world () (format t "hello world."))

I'm trying to compile function with "^C ^C". Here is the stack trace.

   The value NIL is not of type SB-C:POLICY.
       [Condition of type TYPE-ERROR]

    Restarts:
     0: [ABORT] Abort compilation.
     1: [*ABORT] Return to SLIME's top level.
     2: [ABORT] abort thread (#<THREAD "worker" RUNNING {1004247983}>)

    Backtrace:
      0: (SB-C::POLICY-TO-DECL-SPEC NIL T NIL)
          Locals:
            FORCE-ALL = NIL
            POLICY = NIL
            RAW = T
      1: (RESTRICT-COMPILER-POLICY NIL 0)
      2: (SWANK/SBCL::COMPILER-POLICY NIL)
      3: ((LABELS SWANK/SBCL::CF :IN SWANK/BACKEND:SWANK-COMPILE-STRING))
      4: ((FLET SWANK/BACKEND:CALL-WITH-COMPILATION-HOOKS :IN "/Users/colinmcd94/quicklisp/dists/quicklisp/software/slime-2.13/swank/sbcl.lisp") #<CLOSURE (LAMBDA NIL :IN SWANK/BACKEND:SWANK-COMPILE-STRING) {1..
      5: ((FLET SWANK/BACKEND:SWANK-COMPILE-STRING :IN "/Users/colinmcd94/quicklisp/dists/quicklisp/software/slime-2.13/swank/sbcl.lisp") "(defun hello-world () (format t \"hello world.\")) ..)
      6: ((LAMBDA NIL :IN SWANK:COMPILE-STRING-FOR-EMACS))
      7: ((LAMBDA NIL :IN SWANK::COLLECT-NOTES))
      8: (SWANK::MEASURE-TIME-INTERVAL #<CLOSURE (LAMBDA NIL :IN SWANK::COLLECT-NOTES) {1004258B2B}>)
      9: (SWANK::COLLECT-NOTES #<CLOSURE (LAMBDA NIL :IN SWANK:COMPILE-STRING-FOR-EMACS) {1004258AEB}>)
     10: (SWANK::CALL-WITH-BUFFER-SYNTAX NIL #<CLOSURE (LAMBDA NIL :IN SWANK:COMPILE-STRING-FOR-EMACS) {1004258AAB}>)
     11: (SB-INT:SIMPLE-EVAL-IN-LEXENV (SWANK:COMPILE-STRING-FOR-EMACS "(defun hello-world () (format t \"hello world.\")) ..)
     12: (EVAL (SWANK:COMPILE-STRING-FOR-EMACS "(defun hello-world () (format t \"hello world.\")) ..)
     13: (SWANK:EVAL-FOR-EMACS (SWANK:COMPILE-STRING-FOR-EMACS "(defun hello-world () (format t \"hello world.\")) ..)
     14: ((LAMBDA NIL :IN SWANK::SPAWN-WORKER-THREAD))
     15: (SWANK/SBCL::CALL-WITH-BREAK-HOOK #<FUNCTION SWANK:SWANK-DEBUGGER-HOOK> #<FUNCTION (LAMBDA NIL :IN SWANK::SPAWN-WORKER-THREAD) {1006B33B7B}>)
     16: ((FLET SWANK/BACKEND:CALL-WITH-DEBUGGER-HOOK :IN "/Users/colinmcd94/quicklisp/dists/quicklisp/software/slime-2.13/swank/sbcl.lisp") #<FUNCTION SWANK:SWANK-DEBUGGER-HOOK> #<FUNCTION (LAMBDA NIL :IN SWA..
     17: (SWANK::CALL-WITH-BINDINGS ((*STANDARD-OUTPUT* . #1=#<SWANK/GRAY::SLIME-OUTPUT-STREAM {1003B03FA3}>) (*STANDARD-INPUT* . #2=#<SWANK/GRAY::SLIME-INPUT-STREAM {1003A2C693}>) (*TRACE-OUTPUT* . #1#) (*ERR..
     18: ((LAMBDA NIL :IN SWANK::SPAWN-WORKER-THREAD))
     19: ((FLET #:WITHOUT-INTERRUPTS-BODY-1182 :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE))
     20: ((FLET SB-THREAD::WITH-MUTEX-THUNK :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE))
     21: ((FLET #:WITHOUT-INTERRUPTS-BODY-600 :IN SB-THREAD::CALL-WITH-MUTEX))
     22: (SB-THREAD::CALL-WITH-MUTEX #<CLOSURE (FLET SB-THREAD::WITH-MUTEX-THUNK :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE) {820BCFB}> #<SB-THREAD:MUTEX "thread result lock" owner: #<SB-THREAD:THREAD "..
     23: (SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE #<SB-THREAD:THREAD "worker" RUNNING {1004247983}> NIL #<CLOSURE (LAMBDA NIL :IN SWANK::SPAWN-WORKER-THREAD) {100424792B}> (#<SB-THREAD:THREAD "worker" RU..
     24: ("foreign function: call_into_lisp")
     25: ("foreign function: new_thread_trampoline")
     26: ("foreign function: _pthread_body")
     27: ("foreign function: _pthread_body")
     28: ("foreign function: thread_start")

Again, this is running in Aquamacs with Slime, using SBCL.

Upvotes: 2

Views: 327

Answers (2)

Inaimathi
Inaimathi

Reputation: 14065

Now that quicklisp has been updated, you can update your :quicklisp-slime-helper with (ql:quickload :quicklisp-slime-helper), restart SLIME, and be good to go.

You may need to run (ql:update-client) and (ql:update-all-dists) first, depending on how long its been since your last update.

Upvotes: 0

Darren
Darren

Reputation: 56

Running (sb-ext:restrict-compiler-policy 'debug) is the workaround.

I honestly don't know enough to understand why this works, but it does.

Upvotes: 3

Related Questions