caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Michael Wohlwend <micha-1@fantasymail.de>
To: caml-list <caml-list@yquem.inria.fr>
Subject: ocamlc throws exception
Date: Mon, 19 Sep 2005 14:07:57 +0200	[thread overview]
Message-ID: <200509191407.57650.micha-1@fantasymail.de> (raw)

that code :

-----------------------------------------------
class ['a] nil = object(self:'a)
    method next = self
    method set_next n = ()
    method apply (f:'a -> unit) (upto:'a) = ()
end;;


class ['a] node = object(self:'a)
    constraint 'a = 'a #nil   (* line 10 *)
    inherit ['a] nil
    val mutable next = new nil
    method set_next n = next <- n
    method apply f upto =
        f self; if self <> upto then self#next#apply f upto
end;;
   
let a = new node;;
-----------------------------------------

causes this exception:
Fatal error: exception Ctype.Unify(_, 0)
(Program not linked with -g, cannot print stack backtrace)


without line 10 it compiles, allthough I get this error-message:
The type of this expression,
< apply : ('a -> unit) -> 'a -> unit; next : 'a;
  set_next : (< apply : ('b -> unit) -> 'b -> unit; next : 'b;
                set_next : '_c -> unit >
              as 'b) ->
             unit >
as 'a, contains type variables that cannot be generalized


is the exception o.k. ? I know now that the contstraint statement is wrong and 
sensless here...

 Michael


             reply	other threads:[~2005-09-19 12:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-19 12:07 Michael Wohlwend [this message]
2005-09-20  1:10 ` [Caml-list] " Jacques Garrigue
2005-09-20  4:24   ` 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=200509191407.57650.micha-1@fantasymail.de \
    --to=micha-1@fantasymail.de \
    --cc=caml-list@yquem.inria.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).