This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: metaclass <singleton>


Klaus Schilling <Klaus.Schilling@munich.netsurf.de> writes:

> Is it possible to create a singleton metaclass using the MOP
> of goops?
> At most one instance is allowed to exist simultaneously, but
> how may one detect whether previously created instances have
> been garbage collected or at least dropped all strong references
> already?

The problem is that you don't have a guarantee that an instance will
be gc'ed once nothing uses it - it may even be that all strong
references are dropped but the instance remains alive due to
conservative GC biting you.

One way to do this is to allow an instance to be 'deactivated'
explicitely - set some flag on it on 'inactive' and throw error on all
subsequent method invocation attempts.

-- 
How to eff the ineffable?

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]