English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] Optional arguments in inherited methods
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-04-28 (16:13)
From: John Goerzen <jgoerzen@c...>
Subject: [Caml-list] Optional arguments in inherited methods

I have this defined in a base class:

    method private getdata sname oname =  <code here>

In my subclass, I wish to do this:

    method private getdata ?(raw=false) ?(idepth=10) ?extravars sname oname = <code>

The compiler does not seem to like this at all, though I am at a loss to
explain why.  Can someone help me out?

The error I get is:

The method getdata has type
  ?raw:'a -> ?idepth:'b -> ?extravars:'c -> 'd -> 'e -> 'f
  but is expected to have type string -> string -> string

So even stranger is that it doesn't set a type for anything, even though
it has enough information to figure out the type for everything.


-- John

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