(require :asdf)

(push (merge-pathnames "lisp/systems/" (user-homedir-pathname)) asdf:*central-registry*)

(asdf:operate 'asdf:load-op :asdf-binary-locations)
(setq
 asdf:*centralize-lisp-binaries* t
 asdf:*default-toplevel-directory* (merge-pathnames ".fasl/" (user-homedir-pathname)))

(asdf:operate 'asdf:load-op :closer-mop)

(defclass test1 ()
  (test-slot))

;; non-portable trick in
;; ~/src/ktbs/sbcl-perec/lisp-cms/thirdparty/tmp/computed-class/configuration.lisp
;; ~/src/ktbs/SBCL-PEREC/lisp-cms/thirdparty/tmp/hu.dwim.computed-class/source/util.lisp

(defparameter +unbound-slot-value+
  (let ((test (make-instance 'test1)))
    (c2mop:standard-instance-access
     test
     (c2mop:slot-definition-location
      (find 'test-slot (c2mop:class-slots (find-class 'test1))
            :key #'c2mop:slot-definition-name))))
  "We use this symbol for unbound slot marking, so a quick eq is enough instead of a slot-boundp-using-class call.")

  (setf (find-class 'test1) nil))

(setq htab1 (make-hash-table))
(setf (gethash 123 htab1) 'x)
(setf (gethash +unbound-slot-value+ htab1) 'x)

;; sbcl: works
;; acl: works (cant inspect +unbound-slot-value+ in slime)
;; clozure: Can't use #<error printing CCL::IMMEDIATE #x53> as a hash-table key
;; clisp: EVAL: variable +UNBOUND-SLOT-VALUE+ has no value
