Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] prevent more than one object
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-07-03 (11:20)
From: John Max Skaller <skaller@o...>
Subject: Re: [Caml-list] prevent more than one object
Mirko Aigner wrote:

> Hi !
> I'm looking for a way to prevent that from a class more than one object 
> is builded. 

Why? Its a design error. Fix your design.

There's never any need for a singleton object,

because there is no resource for which there
cannot be more than one. I have seen (C++) designs
using singletons and they create an utter mess
because someone wrongly assumed something was

If you want one object, define the class in your
mainline, create it, and then coerce it to
a shared class type which does not provide a constructor.

John Max Skaller,
snail:10/1 Toxteth Rd, Glebe, NSW 2037, Australia.

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: