#:use-module (srfi srfi-9)
#:use-module (ice-9 match)
- #:export (make-rmeta-slot
+ #:export (build-rmeta-slot
+ rmeta-slot-table rmeta-slot-cache
maybe-build-rmeta-slot-cache!
class-rmeta-ref))
;;; ;; Define a class with a meta-slot
;;; (define-class <kah-lassy> ()
;;; (entries #:allocation #:each-subclass
-;;; #:init-value
-;;; (make-rmeta-slot
+;;; #:init-thunk
+;;; (build-rmeta-slot
;;; `((foo . "bar")
;;; (baz . "basil")))))
;;;
;;; ;; Define a subclass
;;; (define-class <sub-lassy> (<kah-lassy>)
;;; (entries #:allocation #:each-subclass
-;;; #:init-value
-;;; (make-rmeta-slot
+;;; #:init-thunk
+;;; (build-rmeta-slot
;;; `((foo . "foo2")
;;; (peanut . "gallery")))))
;;;
(table rmeta-slot-table)
(cache rmeta-slot-cache set-rmeta-slot-cache!))
-(define (make-rmeta-slot table)
- (%make-rmeta-slot table #f))
+(define (build-rmeta-slot table)
+ (lambda ()
+ (%make-rmeta-slot table #f)))
;; Immutable and unique
(define %the-nothing (cons '*the* '*nothing*))
(set-rmeta-slot-cache! rmeta-slot (build-cache))))
(define* (class-rmeta-ref class slot-name key
- #:key (equals? eq?)
- (cache-set! hashq-set!)
- (cache-ref hashq-ref)
+ #:key (equals? equal?)
+ (cache-set! hash-set!)
+ (cache-ref hash-ref)
dflt)
"Search heirarchy of CLASS through the rmeta-slot named SLOT-NAME for
value matching KEY. This also calls maybe-build-rmeta-slot-cache! as a side