Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading compiled Clim-Example "address-book" errors with UNDEFINED-CLASS #926

Closed
kpoeck opened this issue Feb 22, 2020 · 3 comments
Closed
Assignees

Comments

@kpoeck
Copy link
Contributor

kpoeck commented Feb 22, 2020

(ql:quickload "clim-examples" :verbose t)
.....
Writing object to: /Users/karstenpoeck/.cache/common-lisp/clasp-cclasp-boehm-0.4.2-2098-g14ff49604-cst-macosx-x64/Users/karstenpoeck/quicklisp/local-projects/fork-mcclim/Examples/address-book-tmpHOWRFPZE.o
Writing temporary bitcode file to: #P"/Users/karstenpoeck/.cache/common-lisp/clasp-cclasp-boehm-0.4.2-2098-g14ff49604-cst-macosx-x64/Users/karstenpoeck/quicklisp/local-projects/fork-mcclim/Examples/address-book-tmpHOWRFPZE.bc"
;;; Warning: Lisp compilation had style-warnings while
             compiling #<CL-SOURCE-FILE "clim-examples" "address-book">

Condition of type: UNDEFINED-CLASS
Could not find the class CLIM-INTERNALS::|(presentation-type CLIM-DEMO::ADDRESS)|.
Available restarts:
(use :r1 to invoke restart 1)

So it errors while loading the compiled-file not while compiling
same with

;;; Warning: Lisp compilation had style-warnings while
             compiling #<CL-SOURCE-FILE "clim-examples" "selection">

Condition of type: UNDEFINED-CLASS
Could not find the class CLIM-INTERNALS::|(presentation-type CLIM-DEMO::IMAGE)|.

In both cases it works fine after the error:

  • to load the source file again, e.g. (load "/Users/karstenpoeck/quicklisp/local-projects/fork-mcclim/Examples/selection.lisp")
  • and select the restart to recompile the file
@kpoeck kpoeck self-assigned this Feb 22, 2020
@kpoeck
Copy link
Contributor Author

kpoeck commented Feb 22, 2020

The form that creates the trouble is probably:
(define-presentation-type address ())
macroexpands into:

CLIM-DEMO> (macroexpand '(define-presentation-type address ()))

(PROGN
 (EVAL-WHEN (:COMPILE-TOPLEVEL)
   (CLIM-INTERNALS::RECORD-PRESENTATION-TYPE 'ADDRESS
                                             'NIL
                                             'NIL
                                             'NIL
                                             '(&KEY
                                               ((:DESCRIPTION #:G6417322)))
                                             #'(LAMBDA (#:TYPE6417323)
                                                 (DESTRUCTURING-BIND
                                                     ()
                                                     (CLIM-INTERNALS::DECODE-PARAMETERS
                                                      #:TYPE6417323)
                                                   (DECLARE (IGNORABLE))
                                                   (DESTRUCTURING-BIND
                                                       (&KEY
                                                        ((:DESCRIPTION
                                                          #:G6417322)))
                                                       (CLIM-INTERNALS::DECODE-OPTIONS
                                                        #:TYPE6417323)
                                                     (DECLARE
                                                      (IGNORABLE #:G6417322))
                                                     NIL)))
                                             '"address"
                                             'T
                                             'NIL
                                             T
                                             NIL
                                             NIL))
 (EVAL-WHEN (:LOAD-TOPLEVEL :EXECUTE)
   (CLIM-INTERNALS::%DEFINE-PRESENTATION-TYPE ADDRESS
                                              NIL
                                              NIL
                                              NIL
                                              (&KEY
                                               ((:DESCRIPTION #:G6417322)))
                                              NIL
                                              (LAMBDA (#:TYPE6417323)
                                                (DESTRUCTURING-BIND
                                                    ()
                                                    (CLIM-INTERNALS::DECODE-PARAMETERS
                                                     #:TYPE6417323)
                                                  (DECLARE (IGNORABLE))
                                                  (DESTRUCTURING-BIND
                                                      (&KEY
                                                       ((:DESCRIPTION
                                                         #:G6417322)))
                                                      (CLIM-INTERNALS::DECODE-OPTIONS
                                                       #:TYPE6417323)
                                                    (DECLARE
                                                     (IGNORABLE #:G6417322))
                                                    NIL)))
                                              "address"
                                              T
                                              NIL)))

@kpoeck
Copy link
Contributor Author

kpoeck commented Feb 22, 2020

This migh be mcclim using undefined behaviour, this fix in presentation.lisp seem to work:

(eval-when (:compile-toplevel :load-toplevel :execute)
  #-(or excl cmu sbcl openmcl clasp)
  (defun compile-time-clos-p (name)
    (let ((meta (find-class name nil)))
      (and meta
           (typep meta 'standard-class))))

  #+(or excl cmu sbcl openmcl clasp)
  (defun compile-time-clos-p (name)
    (let ((metaclass (find-class name nil)))
      (or (and metaclass
             (typep metaclass 'standard-class))
        (clim-lisp-patch::compile-time-clos-class-p name))))
....

@kpoeck
Copy link
Contributor Author

kpoeck commented Feb 22, 2020

Solves it, so closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant