English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] How to implement "Singleton" design pattern?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-08-05 (09:28)
From: Hendrik Tews <tews@t...>
Subject: Re: [Caml-list] How to implement "Singleton" design pattern?
SooHyoung Oh writes:
   Date: Sat, 3 Aug 2002 14:29:13 +0900
   Subject: [Caml-list] How to implement  "Singleton" design pattern?
   And then how can we solve the (1)?
   There are some possible solutions:
   (a) invisible class definition in a module
   (b) the class definition which can't be called with "new" (private class ?)
   (c) local class definition (in another class definition ?)
   Which one/ones is/are feasible and/or good in Ocaml?
   And are there any other solutions?
If it is enough to detect the error at runtime:
You can use an initializer that raises an exception if a second
object is created. 


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