List Info

Thread: "ocaml_beginners"::[] polymorphic methods (and I've read the same named section of the manual :-)




"ocaml_beginners"::[] polymorphic methods (and I've read the same named section of the manual :-)
user name
2006-07-27 13:10:37
Hello,

I have this code (just a container class) :

  class ['a] myclass (a_list : 'a list) =
  object 
    val the_list = a_list
    method map : 'b. ('a -> 'b) -> 'b myclass =
      fun f -> new myclass (List.iter f the_list)
  end

The compiler gives me this error :

  Characters 87-115:
      method map : 'b. ('a -> 'b) -> 'b myclass =
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  This type scheme cannot quantify 'b :
  it escapes this scope.

I can't understand why ! (I REALLY can't, half a day I'm
on that...)

Thanks
Vincent






Archives up to August 22, 2005 are also downloadable at http://www.connettivo.net/cntprojects/ocaml_beginners/
The archives of the very official ocaml list (the seniors'
one) can be found at http://caml.inria.fr
Attachments are banned and you're asked to be polite, avoid
flames etc. 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http:/
/groups.yahoo.com/group/ocaml_beginners/

<*> To unsubscribe from this group, send an email to:
    ocaml_beginners-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.c
om/info/terms/
 



[1]

about | contact  Other archives ( Real Estate discussion Medical topics )