Advertisement
Guest User

Untitled

a guest
Aug 30th, 2020
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 0.80 KB | None | 0 0
  1. (require 'closer-mop) ;; 1
  2.  
  3. (defmacro gen () ;; 2
  4.   (let ((type (sb-mop:slot-definition-type
  5.                (first (sb-mop:class-slots (find-class 'A))))))
  6.     (unless (equal type 'boolean) (error "No type specified for the slot."))))
  7.  
  8. (progn ;; 3
  9.   (defclass A () ((x :type boolean))) ;; (x :type boolean) -> (x)
  10.   (c2mop:ensure-finalized (find-class 'A))
  11.   (gen))
  12.  
  13. #| SBCL 2.0.5, using sly
  14. 1. eval-defun expressions 1 and 2
  15. 2. compile-defun expression 3
  16. 3. observe error: "no class named common-lisp-user::a"
  17. 4. compile-defun again, error is gone
  18. 5. remove type specification in class A
  19. 6. compile-defun expression 3, observe no error
  20. 7. compile-defun expression 3 again, observe error ("No type specified for the slot")
  21. No such behavior is observed when using eval-defun.
  22. What's happening here?
  23. |#
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement