This repository was archived by the owner on Sep 10, 2021. It is now read-only.
This repository was archived by the owner on Sep 10, 2021. It is now read-only.
Failed to parse (TRUE) because: The constructor TRUE is unknown. #11
Open
Description
I'm following along with the README and noticed a weird interaction between coalton and ASDF, whereby coalton gets confused if I try to reload it after restarting my inferior lisp (sbcl). For example:
First run, A-OK
On the first compile/load, everything is fine:
CL-USER> (ql:quickload :coalton)
To load "coalton":
Load 1 ASDF system:
coalton
; Loading "coalton"
..................................................
[package coalton].................................
[package coalton-user]............................
[package coalton-impl]............................
[package coalton-global-symbols]..................
......
(:COALTON)
CL-USER> (in-package :coalton-user)
#<COMMON-LISP:PACKAGE "COALTON-USER">
COALTON-USER> (coalton-toplevel
(define (gg x) (if x (left 1) (right x))))
COMMON-LISP:NIL
Second run
But if I then slime-restart-inferior-lisp
and reload, coalton gets confused.
CL-USER> (ql:quickload :coalton)
To load "coalton":
Load 1 ASDF system:
coalton
; Loading "coalton"
.
(:COALTON)
CL-USER> (in-package :coalton-user)
#<COMMON-LISP:PACKAGE "COALTON-USER">
COALTON-USER> (coalton-toplevel
(define (gg x) (if x (left 1) (right x))))
; Evaluation aborted on #<COALTON-IMPL:COALTON-PARSE-ERROR {10040AF5A3}>.
The exact error is
Failed to parse (TRUE) because: The constructor TRUE is unknown.
[Condition of type COALTON-IMPL:COALTON-PARSE-ERROR]
Restarts:
0: [RETRY] Retry SLIME REPL evaluation request.
1: [*ABORT] Return to SLIME's top level.
2: [ABORT] abort thread (#<THREAD "repl-thread" RUNNING {10023F9B63}>)
Backtrace:
0: (COALTON-IMPL::ERROR-PARSING (TRUE) "The constructor ~S is unknown." TRUE)
1: ((COMMON-LISP:LABELS COALTON-IMPL::PARSE :IN COALTON-IMPL::PARSE-FORM) (MATCH X (TRUE (LEFT 1)) (FALSE (RIGHT X))))
2: ((COMMON-LISP:LABELS COALTON-IMPL::PARSE :IN COALTON-IMPL::PARSE-FORM) (FN (X) (IF X (LEFT 1) (RIGHT X))))
3: (COALTON-IMPL::PARSE-DEFINE-FORM-FUNCTION GG (X) (IF X (LEFT 1) (RIGHT X)))
4: (COALTON-IMPL::PROCESS-TOPLEVEL-VALUE-DEFINITIONS ((DEFINE (GG X) (IF X # #))))
5: ((COMMON-LISP:MACRO-FUNCTION COALTON-TOPLEVEL) (COALTON-TOPLEVEL (DEFINE (GG X) (IF X # #))) #<unused argument>)
6: ((COMMON-LISP:FLET SB-IMPL::PERFORM-EXPANSION :IN COMMON-LISP:MACROEXPAND-1) #<FUNCTION (COMMON-LISP:MACRO-FUNCTION COALTON-TOPLEVEL) {52E143BB}> COMMON-LISP:NIL)
7: (COMMON-LISP:MACROEXPAND (COALTON-TOPLEVEL (DEFINE (GG X) (IF X # #))) #<NULL-LEXENV>)
8: (SB-INT:SIMPLE-EVAL-IN-LEXENV (COALTON-TOPLEVEL (DEFINE (GG X) (IF X # #))) #<NULL-LEXENV>)
9: (COMMON-LISP:EVAL (COALTON-TOPLEVEL (DEFINE (GG X) (IF X # #))))
Workarounds
Any of the following workarounds can be used immediately after restarting sbcl.
- Manually LOAD the file
library.lisp
after loading the system:(ql:quickload :coalton) (load (asdf:system-relative-pathname :coalton "src/library.lisp"))
- Use
(asdf:load-system :coalton :force t)
instead of(ql:quickload :coalton)
- Remove cached FASL files and recompile
- In shell:
$ rm ~/.cache/common-lisp/sbcl-1.4.16-linux-x64/home/ma/src/repos/coalton/src/*.fasl
- In REPL:
(ql:quickload :coalton)
- In shell:
Metadata
Metadata
Assignees
Labels
No labels