From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id LAA12604 for caml-redistribution; Wed, 11 Dec 1996 11:15:35 +0100 (MET) 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 MAA18325 for ; Tue, 10 Dec 1996 12:09:36 +0100 (MET) Received: from margaux.inria.fr (margaux.inria.fr [128.93.8.2]) by concorde.inria.fr (8.7.6/8.7.1) with ESMTP id MAA02729 for ; Tue, 10 Dec 1996 12:09:35 +0100 (MET) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by margaux.inria.fr (8.7.6/8.7.3) with ESMTP id MAA10252 for ; Tue, 10 Dec 1996 12:09:34 +0100 (MET) Received: from tcs.inf.tu-dresden.de (tcs.inf.tu-dresden.de [141.76.75.101]) by concorde.inria.fr (8.7.6/8.7.1) with ESMTP id MAA02712 for ; Tue, 10 Dec 1996 12:08:49 +0100 (MET) Received: from ithif18.inf.tu-dresden.de (ithif18.inf.tu-dresden.de [141.76.75.118]) by tcs.inf.tu-dresden.de (8.8.3/8.8.3) with SMTP id MAA21147 for ; Tue, 10 Dec 1996 12:08:11 +0100 (MET) Received: by ithif18.inf.tu-dresden.de (SMI-8.6/SMI-SVR4) id MAA11392; Tue, 10 Dec 1996 12:10:50 +0100 Date: Tue, 10 Dec 1996 12:10:50 +0100 Message-Id: <199612101110.MAA11392@ithif18.inf.tu-dresden.de> From: Hendrik Tews CC: caml-list@margaux.inria.fr In-reply-to: <199611211710.SAA08291@arthur.u-strasbg.fr> (message from Christian Boos on Thu, 21 Nov 1996 18:10:27 +0100) Subject: Re: Questions about class types Sender: weis Hello, sorry for answering so late. I had some holidays at the end of November. Christian Boos wrote: Hendrik Tews writes: > ... > Unfortunately B does not match A, because (as it is written in > the documentation under 4.9.2) one can add additional instance > variables, but no additional methods. What is the reason for > this? That's a good question. Maybe O'Caml will add private methods some day ? I am not sure what you exactly mean by "private methods". I am looking for means to distinguish different access privilegs to an object. In a more realistic example (which uses more types than just unit) one would implement a service through a couple of objects. One of them would provide the interface of the service to the outside world. But in a distributed environment it might be useful to update the state of the interface object asyncronously. Therefore the interface object needs some methods in addition to the methods for the interface. (In C++ I would use a friend directive in such a case) In ocaml I could hide all the additional objects in a module implementation. But so far it is not possible to hide methods via signature matching. This is a good idea. You're mistake was on using the ellipsis '..' which doesn't seem to be needed in your example. You are right. I don't need the ellipsis. But I still don't understand the type error I got: Values do not match: val newb : unit -> b is not included in val newb : unit -> < init : unit; .. > If b does not match < init : unit; .. > then the type cast in # let newb () : < init : unit; .. > = ((new b ()) : < init : unit; .. >) should produce an error. On the other side if the type cast is valid, then the types should match. Greetings, Hendrik