Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (require 'closer-mop) ;; 1
- (defmacro gen () ;; 2
- (let ((type (sb-mop:slot-definition-type
- (first (sb-mop:class-slots (find-class 'A))))))
- (unless (equal type 'boolean) (error "No type specified for the slot."))))
- (progn ;; 3
- (defclass A () ((x :type boolean))) ;; (x :type boolean) -> (x)
- (c2mop:ensure-finalized (find-class 'A))
- (gen))
- #| SBCL 2.0.5, using sly
- 1. eval-defun expressions 1 and 2
- 2. compile-defun expression 3
- 3. observe error: "no class named common-lisp-user::a"
- 4. compile-defun again, error is gone
- 5. remove type specification in class A
- 6. compile-defun expression 3, observe no error
- 7. compile-defun expression 3 again, observe error ("No type specified for the slot")
- No such behavior is observed when using eval-defun.
- What's happening here?
- |#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement