From: William Chesters <williamc@paneris.org>
To: caml-list@inria.fr
Subject: [Caml-list] Recursive class types (long-standing question ...)
Date: Tue, 30 Dec 2003 21:02:29 +0000 (GMT) [thread overview]
Message-ID: <20031230210229.ABA5C96BAB@beertje.william.bogus> (raw)
Here's something I've wondered about for a while and just encountered again.
How come this class ..
class virtual ['a] c = object
method virtual b: bool c
end
... gets a constraint 'a = bool? I.e. for instance this doesn't compile:
class virtual ['a] c = object
method virtual b: bool c
method virtual i: int c
(* "This type int should be an instance of type bool" *)
end
Note that the following does work in C++:
template <class a>
struct c {
virtual c<bool> b() = 0;
virtual c<int> i() = 0;
};
I guess there are workarounds but it seems unnecessary that ML should find
recursive parameterised classes harder than C++?
-------------------
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 reply other threads:[~2003-12-30 21:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-12-30 21:02 William Chesters [this message]
2004-01-10 4:43 ` 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=20031230210229.ABA5C96BAB@beertje.william.bogus \
--to=williamc@paneris.org \
--cc=caml-list@inria.fr \
/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