|[ < ]||[ > ]||[ << ]||[ Up ]||[ >> ]||[Top]||[Contents]||[Index]||[ ? ]|
Provides a metaclass to define a singleton class.
Creates a singleton class. A singleton class is a class that is
guaranteed to create only one instance.
The first invocation of
make creates the single instance,
and further attempt of creation returns the same instance.
(define-class single () () :metaclass <singleton-meta>) (define a (make single)) (define b (make single)) (eq? a b) ⇒ #t
The slots of the instance are initialized at the first invocation
make. Initargs of
make are effective only in the
fist invocation, and ignored in the subsequent invocation.
This method just calls
make with the passed arguments.
It is more obvious in the program that you’re dealing with singleton.
An instance of
<singleton-meta>. Instead of specifying
<singleton-meta> as the
:metaclass argument of
define-class, you can inherit this class to give your
class the property of singleton.
|[ < ]||[ > ]||[ << ]||[ Up ]||[ >> ]|
This document was generated on July 19, 2014 using texi2html 1.82.