lot-name)))
        (if (unbound? val)
            (slot-unbound class obj slot-name)
            val)))
    (%class-slot-definition class slot-name have-slot no-slot)))

(define (slot-set! obj slot-name value)
  "Set the slot named @var{slot_name} of @var{obj} to @var{value}."
  (let ((class (class-of obj)))
    (define (have-slot slot)
      ((%slot-definition-slot-set! slot) obj value))
    (define (no-slot)
      (unless (symbol? slot-name)
        (scm-error 'wrong-type-arg #f "Not a symbol: ~S"
                   (list slot-name) #f))
      (slot-missing class obj slot-name value))

    (%class-slot-definition class slot-name have-slot no-slot)))

(define (slot-bound? obj slot-name)
  "Return the value from @var{obj}'s slot with the nam var{slot_name}."
  (let ((class (class-of obj)))
    (define (have-slot slot)
      (not (unbound? ((%slot-definition-slot-ref/raw slot) obj))))
    (define (no-slot)
      (unless (symbol? slot-name)
        (scm-error 'wrong-type-arg #f "Not a symbol: ~S"
                   (list slot-name) #f))
      (not (unbound? (slot-missing class obj slot-name))))
    (%class-slot-definition class slot-name have-slot no-slot)))

(define (slot-exists? obj slot-name)
  "Return @code{#t} if @var{obj} has a slot named @var{slot_name}."
  (define (have-slot slot) #t)
  (define (no-slot)
    (unless (symbol? slot-name)
      (scm-error 'wrong-type-arg #f "Not a symbol: ~S"
                 (list slot-name) #f))
    #f)
  (%class-slot-definition (class-of obj) slot-name have-slot no-slot))

(begin-deprecated
 (define (check-slot-args class obj slot-name)
   (unless (eq? class (class-of obj))
     (scm-error 'wrong-type-arg #f "~S is not the class of ~S"
                (list class obj) #f))
   (unless (symbol? slot-name)
     (scm-error 'wrong-type-arg #f "Not a symbol: ~S"
                (list slot-name) #f)))

 (define (slot-ref-using-class class obj slot-name)
   (issue-deprecation-warning "slot-ref-using-class is deprecated.  "
                              "Use slot-ref instead.")
   (check-slot-args class obj slot-name)
   (slot-ref obj slot-name))

 (define (slot-set-using-class! class obj slot-name value)
   (issue-deprecation-warning "slot-set-using-class! is deprecated.  "
                              "Use slot-set! instead.")
   (check-slot-args class obj slot-name)
   (slot-set! obj slot-name value))

 (define (slot-bound-using-class? class obj slot-name)
   (issue-deprecation-warning "slot-bound-using-class? is deprecated.  "
                              "Use slot-bound? instead.")
   (check-slot-args class obj slot-name)
   (slot-bound? obj slot-name))

 (define (slot-exists-using-class? class obj slot-name)
   (issue-deprecation-warning "slot-exists-using-class? is deprecated.  "
                              "Use slot-exists? instead.")
   (check-slot-args class obj slot-name)
   (slot-exists? obj slot-name)))


