From: nakata keiko <keiko@kaba.or.jp>
To: caml-list@inria.fr
Cc: keiko@kaba.or.jp
Subject: class subtyping
Date: Sat, 18 Dec 2004 00:00:51 +0900 (JST) [thread overview]
Message-ID: <20041218.000051.74664732.keiko@kaba.or.jp> (raw)
I have a question about subtyping between classes.
Why an instance of class a can not coerced into type b?
class a = object (self : 'a)
method f (x : 'a) = x#g
method g = 0
end
class b = object
inherit a
method h = 1
end
let x = ((new b) :> a)
I got an error for the last statement.
I am reading the work on extension problem found at
http://pauillac.inria.fr/~remy/work/expr/
then,
I am curious to know how ocaml compiler judges subtyping relation
involving self types.
Regards,
Keiko NAKATA.
next reply other threads:[~2004-12-17 15:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-17 15:00 nakata keiko [this message]
2004-12-17 16:17 ` Martin Sandin
2004-12-17 16:18 Martin Sandin
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=20041218.000051.74664732.keiko@kaba.or.jp \
--to=keiko@kaba.or.jp \
--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