caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* ocamlc throws exception
@ 2005-09-19 12:07 Michael Wohlwend
  2005-09-20  1:10 ` [Caml-list] " Jacques Garrigue
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Wohlwend @ 2005-09-19 12:07 UTC (permalink / raw)
  To: caml-list

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] ocamlc throws exception
  2005-09-19 12:07 ocamlc throws exception Michael Wohlwend
@ 2005-09-20  1:10 ` Jacques Garrigue
  2005-09-20  4:24   ` Jacques Garrigue
  0 siblings, 1 reply; 3+ messages in thread
From: Jacques Garrigue @ 2005-09-20  1:10 UTC (permalink / raw)
  To: micha-1; +Cc: caml-list

From: Michael Wohlwend <micha-1@fantasymail.de>
> that code :
[..]
> causes this exception:
> Fatal error: exception Ctype.Unify(_, 0)
> (Program not linked with -g, cannot print stack backtrace)

This should be a bug report :-)
Indeed, the problem seems to be still there on the 3.08 branch after
3.08.4.
On the other, this bug does not appear on the 3.09 branch, which is to
be released real soon now. (I hope.)
I'll try to look into this.

Jacques Garrigue


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] ocamlc throws exception
  2005-09-20  1:10 ` [Caml-list] " Jacques Garrigue
@ 2005-09-20  4:24   ` Jacques Garrigue
  0 siblings, 0 replies; 3+ messages in thread
From: Jacques Garrigue @ 2005-09-20  4:24 UTC (permalink / raw)
  To: micha-1; +Cc: caml-list

From: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
> From: Michael Wohlwend <micha-1@fantasymail.de>
> > that code :
> [..]
> > causes this exception:
> > Fatal error: exception Ctype.Unify(_, 0)
> > (Program not linked with -g, cannot print stack backtrace)
> 
> This should be a bug report :-)
> Indeed, the problem seems to be still there on the 3.08 branch after
> 3.08.4.
> On the other, this bug does not appear on the 3.09 branch.

The last sentence is wrong: this bug is common to all versions.
The fix is simple enough, and is already in CVS.
You just have to replace the definition of hide_private_methods in
typing/ctype.ml by

let hide_private_methods ty =
  match (repr ty).desc with
    Tobject (fi, nm) ->
      nm := None;
      let (fl, _) = flatten_fields fi in
      List.iter
        (function (_, k, _) ->
          match field_kind_repr k with
            Fvar r -> set_kind r Fabsent
          | _      -> ())
        fl
  | _ ->
      assert false

Jacques Garrigue


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-09-20  4:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-19 12:07 ocamlc throws exception Michael Wohlwend
2005-09-20  1:10 ` [Caml-list] " Jacques Garrigue
2005-09-20  4:24   ` Jacques Garrigue

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).