From: james woodyatt <jhw@wetware.com>
To: John Goerzen <jgoerzen@complete.org>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Optional arguments in inherited methods
Date: Wed, 28 Apr 2004 09:56:36 -0700 [thread overview]
Message-ID: <02C591A1-9935-11D8-BD03-000A958FF2FE@wetware.com> (raw)
In-Reply-To: <20040428161336.GA3286@excelhustler.com>
On 28 Apr 2004, at 09:13, John Goerzen wrote:
>
> 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?
Presumably, given this in the base class:
method getdataf sname = <code here returns function>
...you wish the compiler to insure that the default values are used for
each of the optional arguments in the [possibly partial] evaluation of
the derived class method.
Well— it doesn't. You have to define the derived class method in two
parts.
method private getdata_aux ?(raw=false) ?(idepth=10) ?extravars sname
oname = <code>
method private getdata sname oname = self#getdata sname oname
> 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.
Yeah, it's already decided you have a problem before it's finished
inferring the types of everything. That might be another one of those
little annoyances... since inferring types when the code is known to be
in error is probably a hard problem.
--
j h woodyatt <jhw@wetware.com>
that's my village calling... no doubt, they want their idiot back.
-------------------
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
next prev parent reply other threads:[~2004-04-28 16:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-04-28 16:13 John Goerzen
2004-04-28 16:56 ` james woodyatt [this message]
2004-04-28 19:43 ` John Goerzen
2004-04-28 22:48 ` Jacques GARRIGUE
2004-04-29 8:11 ` Henri DF
2004-04-29 8:48 ` 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=02C591A1-9935-11D8-BD03-000A958FF2FE@wetware.com \
--to=jhw@wetware.com \
--cc=caml-list@inria.fr \
--cc=jgoerzen@complete.org \
/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).