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 JAA25319; Thu, 5 Feb 2004 09:55:35 +0100 (MET) 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 JAA25653 for ; Thu, 5 Feb 2004 09:55:34 +0100 (MET) Received: from avalon.ens-lsh.fr (mailhost.ens-lsh.fr [193.51.131.2]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id i158tYP29270 for ; Thu, 5 Feb 2004 09:55:34 +0100 (MET) Received: from avalon.ens-lsh.fr (localhost [127.0.0.1]) by avalon.ens-lsh.fr (8.12.8/8.12.8) with ESMTP id i159rxVK009221 for ; Thu, 5 Feb 2004 09:54:00 GMT Received: from ens-notes1.ens-lsh.fr (ens-notes1.ens-lsh.fr [10.2.1.44]) by avalon.ens-lsh.fr (8.12.8/8.12.8) with ESMTP id i159rvEu009209 for ; Thu, 5 Feb 2004 09:53:57 GMT Received: from mostha ([10.3.20.31]) by ens-notes1.ens-lsh.fr (Lotus Domino Release 5.0.10) with SMTP id 2004020509552738:26293 ; Thu, 5 Feb 2004 09:55:27 +0100 Date: Thu, 5 Feb 2004 09:55:12 +0100 From: Damien To: caml-list@inria.fr Subject: Re: [Caml-list] functors and objects Message-Id: <20040205095512.62ef577d.Damien.Pous@ens-lyon.fr> In-Reply-To: <20040204115745J.garrigue@kurims.kyoto-u.ac.jp> References: <20040203190635.6cc61ff0.Damien.Pous@ens-lyon.fr> <20040204115745J.garrigue@kurims.kyoto-u.ac.jp> Organization: mosthagloups X-Mailer: Sylpheed version 0.9.6claws (GTK+ 1.2.10; i386-pc-linux-gnu) Mime-Version: 1.0 X-MIMETrack: Itemize by SMTP Server on ens-notes1/ENS-LSH(Release 5.0.10 |March 22, 2002) at 05/02/2004 09:55:27, Serialize by Router on ens-notes1/ENS-LSH(Release 5.0.10 |March 22, 2002) at 05/02/2004 09:55:28, Serialize complete at 05/02/2004 09:55:28 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Loop: caml-list@inria.fr X-Spam: no; 0.00; damien:01 damien:01 ens-lyon:01 caml-list:01 functors:01 2004:99 jacques:01 val:01 soundness:01 checker:01 ocamlc:01 coupling:01 functors:01 'obj:01 compiler:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Wed, 04 Feb 2004 11:57:45 +0900 Jacques Garrigue wrote: > The closest I can see to what you ask for is > > module type O = sig > type t > val as_o : t -> o > end > ... > > This isn't a problem of soundness. > There is just no such thing as a "partially abstract" object type. there is no such thing... ...in the type system or in the compiler ? Sorry for mixing variants and objects again, but I have got the feeling that since the example I posted with variants works, the first example with objects could/should work : It seems quite natural and reasonable. So why should it be rejected... I don't really see what can prevent the compiler to do it. It looks like an additional check in the type checker, and almost nothing in the compiler (that's just a feeling, I never looked at ocamlc sources...) > But as shown above, you can easily simulate it by coupling an abstract > type with a coercion to an object type. still curious : are such "coercion identity functions" eliminated by the compiler ? > Note however that it would be probably simpler to turn your functors > into parameterized classes: then you can specify constraints on the > parameters with #-types. yes, the project is currently written with classes like ['reactor] obj ['obj] reactor I was just wondering whether the class "reactor" could be translated into a module, since it is instantiated only once. cheers, damien ------------------- 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