Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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
unique.

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, mailto:skaller@ozemail.com.au
snail:10/1 Toxteth Rd, Glebe, NSW 2037, Australia.
voice:61-2-9660-0850


-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners