<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2002/07/769799bb920dee01c56f1972fd80a499"
  from="John Max Skaller &lt;skaller@o...&gt;"
  author="John Max Skaller"
  date="2002-07-08T02:08:15"
  subject="Re: [Caml-list] Polymorphic methods (longest error message ever!)"
  prev="2002/07/0753c3188698d9ea0f77236a0e41c552"
  next="2002/07/5a7ec0755664b20f2ebf374c1c84515e"
  prev-in-thread="2002/07/0753c3188698d9ea0f77236a0e41c552"
  next-in-thread="2002/07/5a7ec0755664b20f2ebf374c1c84515e"
  prev-thread="2002/07/bc2a965ab496aafdf2907a6d9bf85822"
  next-thread="2002/07/8d12ac2d99463ad68064b36be9eba6e9"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] Polymorphic methods (longest error message ever!)">
<msg 
  url="2002/07/0753c3188698d9ea0f77236a0e41c552"
  from="Brian Smith &lt;brian-l-smith@u...&gt;"
  author="Brian Smith"
  date="2002-07-08T01:25:16"
  subject="[Caml-list] Polymorphic methods (longest error message ever!)">
<msg 
  url="2002/07/769799bb920dee01c56f1972fd80a499"
  from="John Max Skaller &lt;skaller@o...&gt;"
  author="John Max Skaller"
  date="2002-07-08T02:08:15"
  subject="Re: [Caml-list] Polymorphic methods (longest error message ever!)">
</msg>
<msg 
  url="2002/07/5a7ec0755664b20f2ebf374c1c84515e"
  from="Jacques Garrigue &lt;garrigue@k...&gt;"
  author="Jacques Garrigue"
  date="2002-07-08T02:53:12"
  subject="Re: [Caml-list] Polymorphic methods (longest error message ever!)">
</msg>
<msg 
  url="2002/07/c1897db7ead6b5e80f6785eec2a57004"
  from="Brian Smith &lt;brian-l-smith@u...&gt;"
  author="Brian Smith"
  date="2002-07-09T06:23:10"
  subject="Re: [Caml-list] Polymorphic methods (syntax)">
</msg>
</msg>
</thread>

<contents>
Brian Smith wrote:

&gt;
&gt;  # class node : node_type = object (self)
&gt;      method as_variant = `Node (self :&gt; node_type)
&gt;    end;;
&gt;                                 ^^^^
&gt;  This expression cannot be coerced to type
&gt;  node_type = &lt; as_variant : 'a. [&gt; `Node of node_type] as 'a &gt;;
&gt;  it has type &lt; as_variant : 'c; .. &gt; as 'b but is here used with type 'b
&gt;
&gt;  # class node : node_type = object (self)
&gt;      method as_variant : 'a. [&gt; `Node of node_type] as 'a
&gt;                        = `Node (self :&gt;  node_type)
&gt;    end;;
&gt; The class type object method as_variant : [&gt; `Node of node_type] end
&gt; is not matched by the class type node_type
&gt; The class type object method as_variant : [&gt; `Node of node_type] end
&gt; is not matched by the class type
&gt;   object method as_variant : [&gt; `Node of node_type] end
&gt; The method as_variant has type 'a. [&gt; `Node of node_type] as 'a
&gt; but is expected to have type 'b. [&gt; `Node of node_type] as 'b
&gt; The universal variable 'b would escape its scope
&gt;
&gt; I have no idea what the error message means. 

Heh. I can't answer your question, but I have to fall about laughing
(is there a French idiom for that?) at the idea this is a long error 
message.
I often get error messages of 100's of lines, my console buffer isn't set
to 10,000 lines without reason. Just imagine your polymophic variant type

    [&gt; Node of node_type]

was replace statement_t below .. and don't ignore the fact that
the ctor arguments themselves are similar polymorphic variant types
like expr_t ... and this isn't a large variant.

----------------------------------------------
and statement_t =
  [
  | `AST_open of range_srcref * qualified_name_t
  | `AST_comment of string (* for documenting generated code *)

  (* definitions *)
  | `AST_function of range_srcref * id_t * parameter_t list * typecode_t 
* statement_t list
  | `AST_procedure of range_srcref * id_t * parameter_t list * 
statement_t list

  (* types *)
  | `AST_union of range_srcref * id_t * (id_t * typecode_t) list
  | `AST_struct of range_srcref * id_t * (id_t * typecode_t) list
  | `AST_type_alias of range_srcref * id_t * typecode_t

  (* variables *)
  | `AST_val_decl of range_srcref * id_t * typecode_t option * expr_t option
  | `AST_var_decl of range_srcref * id_t * typecode_t option * expr_t option
 
  (* module system *)
  | `AST_untyped_module of range_srcref * id_t * statement_t list 
  | `AST_typed_module of range_srcref * id_t * typecode_t * statement_t 
list 
  | `AST_module_binding of range_srcref * id_t * expr_t
  | `AST_typed_functor of range_srcref * id_t * parameter_t list * 
typecode_t * statement_t list
  | `AST_untyped_functor of range_srcref * id_t * parameter_t list * 
statement_t list
  | `AST_interface of range_srcref * id_t * statement_t list
  | `AST_type of range_srcref * id_t
  | `AST_function_decl of range_srcref * id_t * typecode_t
  | `AST_procedure_decl of range_srcref * id_t * typecode_t

 
  (* control structures: primitives *)
  | `AST_label of range_srcref * id_t (* for testing the code generator! *)
  | `AST_goto of range_srcref * id_t (* for testing the code generator! *)
  | `AST_call of range_srcref * expr_t * expr_t
  | `AST_read of range_srcref * id_t
  | `AST_return of range_srcref * expr_t
  | `AST_nop of range_srcref * string

  | `AST_block of range_srcref * statement_t list
  | `AST_if of
    range_srcref *
    (range_srcref * (expr_t * statement_t)) list *
    (range_srcref * statement_t)
  | `AST_while of range_srcref * expr_t * statement_t

  (* exceptions *)
  | `AST_attempt of
    range_srcref *
    (range_srcref * statement_t) *         (* the attempt *)
    (range_srcref * statement_t list) *    (* the handlers *)
    (range_srcref * statement_t list)      (* the finally block *)
  | `AST_except_handler of range_srcref * id_t * parameter_t list * 
statement_t list
  | `AST_raise of range_srcref * id_t * expr_t

  (* binding structures [prolog] *)
  | `AST_abs_decl of range_srcref * id_t * c_t
  | `AST_const_decl of range_srcref * id_t * typecode_t * c_t
  | `AST_fun_decl of range_srcref * id_t * typecode_t list * typecode_t 
* c_t
  | `AST_proc_decl of range_srcref * id_t * typecode_t list * c_t
  | `AST_header of range_srcref * string
  | `AST_code of range_srcref * string

  | `AST_export of range_srcref * suffixed_name_t * string
  ]


-- 
John Max Skaller, mailto:skaller@ozemail.com.au
snail:10/1 Toxteth Rd, Glebe, NSW 2037, Australia.
voice:61-2-9660-0850




-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners

</contents>

</message>

