;; -*-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-interface (standard-library singleton)

  (import (standard-library core))

  (define-param-class :singleton (%element) <object> #f #f #t module ()
    ((obj %element module module)))

  (declare make-singleton
	   (:param-proc (%element)
			(%element)
			(:singleton %element)
			pure))

  (declare singleton-get-element
	   (:param-proc (%element)
			((:singleton %element))
			%element
			pure))

  (declare singleton-set-element!
	   (:param-proc (%element)
			((:singleton %element) %element)
			<none>
			nonpure)))
