File: singleton.thi

package info (click to toggle)
theme-d 7.2.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 21,036 kB
  • sloc: lisp: 9,625; sh: 5,321; makefile: 715; ansic: 477
file content (36 lines) | stat: -rw-r--r-- 862 bytes parent folder | download | duplicates (3)
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)))