caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
To: jhw@conjury.org
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] spurious warning? "polymorphic method not principal"
Date: Fri, 17 Mar 2006 18:55:07 +0900 (JST)	[thread overview]
Message-ID: <20060317.185507.03978259.garrigue@math.nagoya-u.ac.jp> (raw)
In-Reply-To: <B0DFEE75-13D5-4D9E-BCDB-96EA99E1FFAD@conjury.org>

From: j h woodyatt <jhw@conjury.org>

> > (* test.ml *)
> > class alfa = object(_:'self)
> >   method x: 'a. ('a, out_channel, unit) format -> 'a = Printf.printf
> > end
> >
> > class bravo a = object
> >   val y: alfa = (a :> alfa)
> >   initializer y#x "bravo initialized"
> > end
> >
> > class charlie a = object
> >   inherit bravo a
> >   initializer y#x "charlie initialized"
> > end
> 
> $ ocamlc -principal -o test test.ml
> File "test.ml", line 13, characters 14-17:
> Warning X: this use of a polymorphic method is not principal.
> 
> It warns about the use of the polymorphic method on the object in the  
> membership of the base class, but only when it's invoked from the  
> derived class.  This confuses me.  Is this a bug in my code?   

No, this is a bug in the compiler. I'll try to fix it.

Jacques Garrigue


      reply	other threads:[~2006-03-17  9:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-16 22:23 j h woodyatt
2006-03-17  9:55 ` Jacques Garrigue [this message]

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=20060317.185507.03978259.garrigue@math.nagoya-u.ac.jp \
    --to=garrigue@math.nagoya-u.ac.jp \
    --cc=caml-list@inria.fr \
    --cc=jhw@conjury.org \
    /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).