(define-module (simple-sealers) #:use-module (srfi srfi-9) #:use-module (srfi srfi-9 gnu) #:export (make-sealer-triplet)) ;; Make a sealer, unsealer, and brand-check predicate using ;; dynamic type generation. (define (make-sealer-triplet) (define-record-type (seal val) ; constructor (sealer) sealed? ; predicate (brand-check) (val unseal)) ; accessor (unsealer) ;; Prevents snooping on contents at REPL, etc (define (print-seal _rec port) (display "#" port)) (set-record-type-printer! print-seal) ;; Return sealer, unsealer, sealed? predicate (values seal unseal sealed?))