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 SAA22407; Wed, 2 Jul 2003 18:14:24 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id SAA22557 for ; Wed, 2 Jul 2003 18:14:23 +0200 (MET DST) Received: from mailrelay1.alcatel.de (mailrelay2.alcatel.de [194.113.59.71]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h62GENf27723 for ; Wed, 2 Jul 2003 18:14:23 +0200 (MET DST) Received: from alcatel.de (slbpx8.bln.sel.alcatel.de [149.204.198.4]) by mailrelay1.alcatel.de (8.9.3/8.9.3) with ESMTP id SAA03202 for ; Wed, 2 Jul 2003 18:14:02 +0200 (MET DST) Message-ID: <3F0304DF.1010300@alcatel.de> Date: Wed, 02 Jul 2003 18:14:23 +0200 From: Mirko Aigner User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3) Gecko/20030312 X-Accept-Language: en-us, en MIME-Version: 1.0 To: caml-list@inria.fr Subject: [Caml-list] prevent more than one object Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Alcanet-MTA-scanned-and-authorized: yes X-Spam: no; 0.00; alcatel:99 builded:01 val:01 mli:01 mutable:01 int:01 unit:03 wrote:03 object:03 data:03 let:04 thx:05 problem:07 therefor:07 i'm:07 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi ! I'm looking for a way to prevent that from a class more than one object is builded. Therefor I wrote this little files (*singleton.ml*) class singleton x = object val mutable data : int = x; method get_data = data; method set_data newdata = data <- newdata; end;; let instance = new singleton 0 let get_instance = instance (*singleton.mli*) class singleton : int -> object method get_data : int method set_data : int -> unit end;; val get_instance : singleton The problem is the class is still public and instances can be build, any way to prevent this ?! thx for helping Mirko Aigner ------------------- 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