jcbeaudoin / MKCL

ManKai Common Lisp
Other
33 stars 8 forks source link

Loading "named-readtables" with MKCL gives error #13

Closed m-e-leypold closed 1 year ago

m-e-leypold commented 1 year ago

Note: The code on the named readtables side looks completely allright. I'm posting this issue here because I suspect this might an mkcl bug.

When trying to load https://github.com/melisgl/named-readtables via quicklisp in MKCL (in the SLIME REPL) I get the following:

CL-USER> (asdf:load-system "named-readtables")
;;; Warning: in file /user/home/mel/my/quicklisp/dists/quicklisp/software/named-readtables-20220331-git/src/named-readtables.lisp, end position 14949,
;;;     and form: (DEFINE-API MERGE-READTABLES-INTO (RESULT-READTABLE &REST NAMED-READTABLES) ...)
;;;   Too many arguments passed to SET-MACRO-CHARACTER

and then in a slime backtrace buffer:

COMPILE-FILE-ERROR while compiling
   #<ASDF/INTERFACE::NAMED-READTABLES-SOURCE-FILE "named-readtables" "named-readtables">
   [Condition of type UIOP/LISP-BUILD:COMPILE-FILE-ERROR]

Restarts:
 0: [RETRY] Retry compiling #<ASDF/INTERFACE::NAMED-READTABLES-SOURCE-FILE "named-readtables" "named-readtables">.
 1: [ACCEPT] Continue, treating compiling #<ASDF/INTERFACE::NAMED-READTABLES-SOURCE-FILE "named-readtables" "named-readtables"> as having been successful.
 2: [RETRY] Retry ASDF operation.
 3: [CLEAR-CONFIGURATION-AND-RETRY] Retry ASDF operation after resetting the configuration.
 4: [RETRY] Retry ASDF operation.
 5: [CLEAR-CONFIGURATION-AND-RETRY] Retry ASDF operation after resetting the configuration.
 --more--

Backtrace:
  0: LAMBDA, closure generated from SWANK-DEBUGGER-HOOK
  1: BYTECODE [Evaluation of: (ASDF/OPERATE:LOAD-SYSTEM "named-readtables")]
  2: LAMBDA, closure generated from LAMBDA
  3: TRACK-PACKAGE
  4: LAMBDA, closure generated from LAMBDA
  5: LAMBDA, closure generated from REPL-EVAL

I am a bit lost what the problem is, since also I seem to be able to load the referenced file juts fine:

CL-USER> (load "/user/home/mel/my/quicklisp/dists/quicklisp/software/named-readtables-20220331-git/src/named-readtables.lisp")
#P"/user/home/mel/my/quicklisp/dists/quicklisp/software/named-readtables-20220331-git/src/named-readtables.lisp"
CL-USER> 

The two occurrences of SET-MACRO-CHARACTER in the file also look totally fine and have 4 arguments which should be fine according to the CLHS.

Admittedly this issue is a bit of a fishing expedition. I'm a bit lost how to debug this on the MKCL side. Perhaps you can give me some pointers?

The MKCL version I'm using:

$ mkcl --version
MKCL 1.1.11.187-19222c1

If I start with an empty compilation cache I get some additional warnings, which as precursors might be of interest. I'll document those in an extra reply-

m-e-leypold commented 1 year ago

Starting with an empty compilation cache:

CL-USER> (asdf:load-system "named-readtables")
;;; Warning: 
  EDITOR-HINTS.NAMED-READTABLES has not been ported to MKCL. We fall back to a
  portable implementation of readtable iterators. This implementation has to
  grovel through all available characters. On Unicode-aware implementations
  this may come with some costs.
;;; Warning: Lisp compilation had style-warnings while compiling
   #<ASDF/INTERFACE::NAMED-READTABLES-SOURCE-FILE "named-readtables" "cruft">
;;; Warning: in file /user/home/mel/my/quicklisp/dists/quicklisp/software/named-readtables-20220331-git/src/named-readtables.lisp, end position 14949,
;;;     and form: (DEFINE-API MERGE-READTABLES-INTO (RESULT-READTABLE &REST NAMED-READTABLES) ...)
;;;   Too many arguments passed to SET-MACRO-CHARACTER
m-e-leypold commented 1 year ago

The referenced occurrence of set-macro-character: (set-macro-character char reader-fn non-terminating-p to)

jcbeaudoin commented 1 year ago

Thank you for the report. I'll investigate some more later this evening...

jcbeaudoin commented 1 year ago

Found a bad proclaim in cmp/sysfun.lsp. Most probably the source of the bug. I pushed a fix on master HEAD. Could you try it?

m-e-leypold commented 1 year ago

Will do. If I don't succeed in the next ~30 minutes, I'll only be able to look at it tomorrow in the evening.

m-e-leypold commented 1 year ago

Great, it works now! Thank you very much! :-)