From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 794EFBC84 for ; Tue, 22 Mar 2005 20:57:01 +0100 (CET) Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.192]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j2MJv08B006831 for ; Tue, 22 Mar 2005 20:57:00 +0100 Received: by rproxy.gmail.com with SMTP id a41so1520692rng for ; Tue, 22 Mar 2005 11:57:00 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=jsLiF4+cF/SPV96YYJaEWfMHOEKD650SCKs3urRRHUIfmDBK/D+ttAfSmdyKZhN1x3kBS/LeIKgW3YIGH1WQOw32t/xH3Gr2xvfXGr2Bbwkail8Qd+fY4Pk/W/3B12WqanS3aTkNN2riTdbxoAREaRO+0C3OLf+7+/3M6etFJf8= Received: by 10.38.10.48 with SMTP id 48mr5817191rnj; Tue, 22 Mar 2005 11:56:59 -0800 (PST) Received: by 10.38.162.68 with HTTP; Tue, 22 Mar 2005 11:56:58 -0800 (PST) Message-ID: <6b8a91420503221156e994d7c@mail.gmail.com> Date: Tue, 22 Mar 2005 20:56:58 +0100 From: Remi Vanicat Reply-To: Remi Vanicat To: Marc Herbert Subject: Re: [Caml-list] extending a functional updater implicitly publicizes sub-updater method? Cc: caml-list@yquem.inria.fr In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit References: X-Miltered: at nez-perce with ID 4240788C.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 implicitly:01 coe:01 sml:01 implicitly:01 ocaml:01 htmlman:01 superclass:01 val:01 val:01 ocaml:01 srv:98 ...:98 wrote:01 inherit:01 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_BY_IP autolearn=disabled version=3.0.2 X-Spam-Level: On Tue, 22 Mar 2005 20:18:06 +0100 (CET), Marc Herbert wrote: > [This is a shameless repost of > http://groups.google.com/groups?selm=d1coe3%242l%241%40wolfberry.srv.cs.cmu.edu > Looks like comp.lang.ml is more comp.lang.sml than comp.lang.caml...] For an unknown reason, my answer (message-id: <87r7ieuf54.dlv@vanicat.homelinux.org>) that have been post on the neuf.fr news server does not appear on google, so I will suppose that it hasn't propagate, and I will re-answer here > I don't understand why my private subupdater is "made public implicitly" > > Example inspired from > http://caml.inria.fr/ocaml/htmlman/manual005.html#ss:functional-objects > This sample code is quite similar to extending the constructor of a > superclass. > > class functional_point = > object > val x = 0 > method private forward = {< x = x + 1 >} > end;; > > class functional_color_point = > object > inherit functional_point as super > val color = 0 > > (* color_forward is made implicitly public ?!? *) > method private color_forward = {< color = color + 1 >} > > method private forward = super#forward#color_forward > end;; In ocaml, you can only call a private method on self. super#forward is not self, so you cannot call the color_forward method on it. Then as a private method can be made public latter, ocaml make the method public to make the code correct, and give you this warning.