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 NAA09231; Thu, 18 Jul 2002 13:37:17 +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 NAA09227 for ; Thu, 18 Jul 2002 13:37:16 +0200 (MET DST) X-SPAM-Warning: Sending machine is listed in blackholes.five-ten-sg.com Received: from athlon.baretta.com (r-mi214-6a159.tin.it [62.211.4.159]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g6IBbFH01326 for ; Thu, 18 Jul 2002 13:37:15 +0200 (MET DST) Received: from baretta.com (localhost.localdomain [127.0.0.1]) by athlon.baretta.com (Postfix) with ESMTP id 5B9692724F; Thu, 18 Jul 2002 13:44:27 +0200 (CEST) Message-ID: <3D36AA1B.2090101@baretta.com> Date: Thu, 18 Jul 2002 13:44:27 +0200 From: Alessandro Baretta Organization: Baretta srl -- www.baretta.com User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020529 X-Accept-Language: it, en MIME-Version: 1.0 To: Gerd Stolpmann , Ocaml Subject: Re: [Caml-list] Protected methods References: <3D369B89.1030000@baretta.com> <3D36A00A.7010807@gerd-stolpmann.de> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Gerd Stolpmann wrote: > No, you cannot restrict the type of classes by signatures. > The only way I know to protect a method is to define an opaque > type that is hidden by the signature, e.g. > > sample.ml: > > type protector = unit > > class a = > object > method m () = ... > ... > end > > sample.mli: > > type protector > > class a : > object > method m : protector -> XXX > ... > end > > You cannot call m from other modules because you cannot create values > for the type "protector". > > Gerd Effective, definitely, but practical? Is this not supposed to be a feature of any general purpose object oriented language? Anyway, for the meantime I'll keep the method public, and make sure I don't use it anywhere except where it makes sense, and I'll wait for some more insight from the developers. Thank you very much, Gerd. Alex ------------------- 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