caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Khoo Yit Phang <khooyp@cs.umd.edu>
To: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
Cc: Khoo Yit Phang <khooyp@cs.umd.edu>, caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Problem with class method and polymorphic variants
Date: Wed, 25 Jun 2008 01:17:10 -0400	[thread overview]
Message-ID: <F3ADA092-F3DE-445F-8029-295160387CE6@cs.umd.edu> (raw)
In-Reply-To: <20080625.121226.240480867.garrigue@math.nagoya-u.ac.jp>

Hi,

Thanks for the quick response! I've encountered another strange one  
that may be related. The code below compiles only if you remove the  
underscore in the method "_a". The error message is similar to the  
earlier one, but I think it's a different problem?

class ['a] node d =
     object
         method _d : 'a = d
         method p (x : 'a) = "<data>"
     end

class ['a] pnode data =
     object (self)
         inherit ['a] node data
         (* doesn't compile with the underscore in "_a" *)
         method _a = self
         method p = function `P p -> p#name
     end

Yit
June 25, 2008

On Jun 24, 2008, at 11:12 PM, Jacques Garrigue wrote:

> From: Khoo Yit Phang <khooyp@cs.umd.edu>
>> Hi,
>>
>> I discovered that the attached snippet of Ocaml does not compile in
>> ocamlc, but does work in the ocaml toplevel (tested in v3.10.0 and
>> 3.10.2). Removing anything (except the :int annotation) causes the
>> error to go away. Is it a bug in the type-checker?
>>
>> # cat polymorphic-variants-methods-bug.ml
>> class ['a] c (a : 'a) =
>>    object (s)
>>        method s = s
>>        method d : int = match a with `A b -> b#num
>>    end
>
> Of course this is a bug. I added it myself to the bug tracker.
> By the way you could also trigger it in the toplevel by giving
> explicitly a module signature (this is what ocamlc does internally).
>
> This is now fixed in CVS, branch release310.
> Note that you may still have other kinds of problems using
> upper-bounded polymorpic variants inside constraints. Just report them
> as you go...
>
> Cheers,
>
> Jacques Garrigue


  reply	other threads:[~2008-06-25  5:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-24 18:17 Khoo Yit Phang
2008-06-25  3:12 ` [Caml-list] " Jacques Garrigue
2008-06-25  5:17   ` Khoo Yit Phang [this message]
2008-06-26  2:46     ` 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=F3ADA092-F3DE-445F-8029-295160387CE6@cs.umd.edu \
    --to=khooyp@cs.umd.edu \
    --cc=caml-list@yquem.inria.fr \
    --cc=garrigue@math.nagoya-u.ac.jp \
    /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).