1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
;; -*-theme-*-
;; Copyright (C) 2015-2018, 2021 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
(parameters %element)
(attributes equal-by-value)
(inheritance-access hidden)
(constructor-access module)
(construct ((obj1 %element)) () (pure))
(fields
(obj %element module module obj1)))
(declare-method make-singleton
(:param-proc (%element)
(%element)
(:singleton %element)
pure))
(declare-method singleton-get-element
(:param-proc (%element)
((:singleton %element))
%element
pure))
(declare-method singleton-set-element!
(:param-proc (%element)
((:singleton %element) %element)
<none>
nonpure)))
|