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 DAA15345; Wed, 2 Apr 2003 03:34:40 +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 DAA15563 for ; Wed, 2 Apr 2003 03:34:38 +0200 (MET DST) Received: from kurims.kurims.kyoto-u.ac.jp (kurims.kurims.kyoto-u.ac.jp [130.54.16.1]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h321Ya513347 for ; Wed, 2 Apr 2003 03:34:36 +0200 (MET DST) Received: from localhost (suiren.kurims.kyoto-u.ac.jp [130.54.16.25]) by kurims.kurims.kyoto-u.ac.jp (8.9.3p2/3.7W) with ESMTP id KAA02443; Wed, 2 Apr 2003 10:34:26 +0900 (JST) To: caml-list@davidb.org Cc: caml-list@inria.fr Subject: Re: [Caml-list] Typing problem with polymorphic variants In-Reply-To: <20030401184428.GA895@opus.davidb.org> References: <3E89CDA0.7090200@baretta.com> <20030401184428.GA895@opus.davidb.org> X-Mailer: Mew version 1.94.2 on Emacs 21.2 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20030402103425U.garrigue@kurims.kyoto-u.ac.jp> Date: Wed, 02 Apr 2003 10:34:25 +0900 From: Jacques Garrigue X-Dispatcher: imput version 20000228(IM140) X-Spam: no; 0.00; jacques:01 caml-list:01 foo:01 baz:01 typable:01 unsound:01 generative:01 jerome:01 vouillon:01 publi:01 subsumption:01 inherit:01 variants:01 int:01 garrigue:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk From: David Brown > I would apply the same question to the object system: why can a > signature not hide methods of a class. > > Does making the signature more restrictive somehow hurt the type system? > > e.g.: > > class foo : object method baz : int end = > object > method baz = 5 > method bar = 2 > end > > gives: > > The class type object method bar : int method baz : int end > is not matched by the class type object method baz : int end > The public method bar cannot be hidden Just consider now a variant on your example: class foo : object method baz : int end = object (self) method baz = self#bar + 3 method bar = 2 end class bar = object inherit foo method bar = "hello" end If you can forget the method bar, the class bar becomes typable. However (new bar)#baz lead to computing ["hello" + 3] which is unsound. You can try to change the problem in many ways, but the conclusion is that there is no way to allow the hiding of a public method without a notion of generative types for objects or views. There is a paper by Jerome Vouillon on the subject http://www.pps.jussieu.fr/~vouillon/publi.html Combining subsumption and binary methods: An object calculus with views. Jacques Garrigue ------------------- 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