From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id LAA15891; Mon, 5 Aug 2002 11:28:36 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id LAA15928 for ; Mon, 5 Aug 2002 11:28:35 +0200 (MET DST) Received: from tcs.inf.tu-dresden.de (tcs.inf.tu-dresden.de [141.76.75.101]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g759SYP02901 for ; Mon, 5 Aug 2002 11:28:34 +0200 (MET DST) Received: from ithif51 (ithif51 [141.76.75.51]) by tcs.inf.tu-dresden.de (8.12.0.Beta7/8.12.0.Beta7) with ESMTP id g759SY1j028471 for ; Mon, 5 Aug 2002 11:28:34 +0200 (MET DST) Received: from tews by ithif51 with local (Exim 3.12 #1 (Debian)) id 17beAE-0002iM-00 for ; Mon, 05 Aug 2002 11:28:34 +0200 From: Hendrik Tews MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15694.17729.991123.603983@gargle.gargle.HOWL> Date: Mon, 5 Aug 2002 11:28:33 +0200 (CEST) To: "Caml-List" Subject: Re: [Caml-list] How to implement "Singleton" design pattern? In-Reply-To: <002d01c23aae$b44a6490$fe00a8c0@hama> References: <002d01c23aae$b44a6490$fe00a8c0@hama> X-Mailer: VM 6.75 under Emacs 20.7.2 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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. Bye, Hendrik ------------------- 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