From: Steffen Smolka <smolka@cs.cornell.edu>
To: Leo White <leo@lpw25.net>, Caml List <caml-list@inria.fr>
Subject: Re: [Caml-list] extend object type?
Date: Fri, 10 Feb 2017 11:43:54 -0500 [thread overview]
Message-ID: <CAGh2ivAY_QO7PAqi-HtFNHKOYO_CLsAk-N38fAsjkRjaj52AUA@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 554 bytes --]
Thanks, this will do! The #t1 syntax is something else I was looking for.
-- Steffen
> You can't do it for object types directly, but you can do it for class
> types:
> class type t1 = object method f : int end
> class type t2 = object inherit t1 method g : bool end
> Defining a class type also defines the corresponding object type, which
> means the above results in types called t1 and t2 that are equal to the
> ones you want.
> This trick also lets you use #t2 to refer to the polymorphic type < f :
> int; g : bool; .. >.
> Regards,
> Leo
[-- Attachment #2: Type: text/html, Size: 792 bytes --]
next reply other threads:[~2017-02-10 16:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-10 16:43 Steffen Smolka [this message]
-- strict thread matches above, loose matches on Subject: below --
2017-02-10 14:49 Hongbo Zhang (BLOOMBERG/ 731 LEX)
2017-02-10 4:15 Steffen Smolka
2017-02-10 8:30 ` Kakadu
2017-02-10 9:42 ` Leo White
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=CAGh2ivAY_QO7PAqi-HtFNHKOYO_CLsAk-N38fAsjkRjaj52AUA@mail.gmail.com \
--to=smolka@cs.cornell.edu \
--cc=caml-list@inria.fr \
--cc=leo@lpw25.net \
/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