;; -*-theme-*-

;; Copyright (C) 2015-2018  Tommi Höynälänmaa
;; Distributed under GNU Lesser General Public License version 3,
;; see file doc/LGPL-3.

(define-body (standard-library singleton)


  (define-param-proc make-singleton (%element)
		     (((obj %element)) (:singleton %element) pure)
    (make (:singleton %element) obj))


  (define-param-proc singleton-get-element (%element)
		     (((sgt (:singleton %element))) %element pure)
    (field-ref sgt 'obj))


  (define-param-proc singleton-set-element! (%element)
		     (((sgt (:singleton %element)) (obj %element))
		      <none> nonpure)
    (field-set! sgt 'obj obj)))
