From: Jacques Garrigue <garrigue@kurims.kyoto-u.ac.jp>
To: wester@ilt.fhg.de
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] classes and labels
Date: Wed, 21 Mar 2001 09:06:22 +0900 [thread overview]
Message-ID: <20010321090622X.garrigue@kurims.kyoto-u.ac.jp> (raw)
In-Reply-To: <200103201502.QAA27766@ilt.fhg.de>
From: wester@ilt.fhg.de
> class myclass ?(n=0) () =
> object
> val nn = n;
> method get_nn = nn
> method clone (na: int) = let (mc: myclass) = new myclass ~n:na () in mc;
> end;;
>
> that produces the following error message in the toplevel:
>
> Characters 5-153:
> The expression "new myclass" has type ?n:int -> unit -> myclass
> but is used with type int -> unit -> myclass
What version of ocaml are you using ?
At least, I couldn't reproduce the problem with 3.01:
Objective Caml version 3.01
# class myclass ?(n=0) () =
object
val nn = n;
method get_nn = nn
method clone (na: int) = let (mc: myclass) = new myclass ~n:na () in mc;
end;;
class myclass :
?n:int ->
unit ->
object val nn : int method clone : int -> myclass method get_nn : int end
And this both with the -labels option on and off.
By the way, you don't need all these annotations in the clone method:
method clone na = new myclass ~n:na ()
Regards,
Jacques Garrigue
-------------------
To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr
prev parent reply other threads:[~2001-03-21 0:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-03-20 15:02 wester
2001-03-20 22:11 ` Gerd Stolpmann
2001-03-21 0:06 ` Jacques Garrigue [this message]
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=20010321090622X.garrigue@kurims.kyoto-u.ac.jp \
--to=garrigue@kurims.kyoto-u.ac.jp \
--cc=caml-list@inria.fr \
--cc=wester@ilt.fhg.de \
/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