[Prev][Next][Index][Thread]
Re: simple method dispatch question
Barry Margolin wrote:
>
> One of the other posters said that when he said "singleton" he wasn't
> talking about the Design Pattern with this name, and he thought it was
> unfortunate that Dylan used the same term. But in fact, Dylan's singletons
> *are* the Singleton Design Pattern. The difference is that they're built
> into the language, so you don't have to define classes to implement
> singletons. And the explanation I gave above is the reason why the
> Singleton Design Pattern exists.
>
My original reading of the DRM led me believe that they weren't
singletons in the GOF sense because they weren't guaranteed to be
unique, whereas the contributors to this thread clearly think otherwise.
The DRM says:
"...If a singleton for the specified object already exists,
implementations are free to return it rather than allocate a new
singleton."
The words 'free to' rather seem to preclude any guarantee of uniqueness.
Why was it phrased like this? The only possible reason I could come up
with was that it would make it easier for the implementer to
transparently, efficiently distribute a dylan prog over multiple CPUs
which didn't have shared memory - and I don't believe that.
Any suggestions or clarification?
thanks
jan
Follow-Ups:
References: