caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Remi Vanicat <remi.vanicat@gmail.com>
To: Marc Herbert <marc.herbert.1@ml.free.fr>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] extending a functional updater implicitly publicizes sub-updater method?
Date: Tue, 22 Mar 2005 20:56:58 +0100	[thread overview]
Message-ID: <6b8a91420503221156e994d7c@mail.gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.58.0503222012210.3222@fcat>

On Tue, 22 Mar 2005 20:18:06 +0100 (CET), Marc Herbert
<marc.herbert.1@ml.free.fr> 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.


  reply	other threads:[~2005-03-22 19:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-22 19:18 Marc Herbert
2005-03-22 19:56 ` Remi Vanicat [this message]
2005-03-22 23:34   ` wish for something like 'restricted' methods james woodyatt
2005-03-23  5:03     ` [Caml-list] " Jacques Garrigue
2005-03-23  8:22       ` james woodyatt
2005-03-30 13:16   ` private methods restricted to self? Marc Herbert
2005-03-31  2:30     ` [Caml-list] " Jacques Garrigue

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6b8a91420503221156e994d7c@mail.gmail.com \
    --to=remi.vanicat@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=marc.herbert.1@ml.free.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).