From: Didier Remy <remy@morgon.inria.fr>
To: Christopher Jeris <cjeris@math.mit.edu>
Cc: Xavier Leroy <Xavier.Leroy@inria.fr>, caml-list@inria.fr
Subject: Re: anonymous record types in variants
Date: Wed, 17 Feb 1999 20:14:03 +0100 [thread overview]
Message-ID: <19990217201403.48891@morgon.inria.fr> (raw)
In-Reply-To: <Pine.SUN.4.03.9902171247250.28377-100000@severi.mit.edu>; from Christopher Jeris on Wed, Feb 17, 1999 at 01:09:06PM -0500
> But an analogous construction already exists in the object system:
I was expecting this question...
Yes, it is possible to have anonymous records and still keep principal
types, using `polymorphic' records (a restriction of `extensible records')
--this is the way objects are typed.
However, this will cost at runtime, unless there are very severe,
complicated compile-time/link-time optimizations. (In the case of objects,
this cost is expected because you are programming by message invocation.)
Since there are already objects in Ocaml, the need for
polymorphic/extensible records is not so strong. This would be convenient
but would not add much expressivity (you can always use objects). Hence the
gain may be insufficient to justify a complication of the language and of
the implementation.
> Another thing that kind of confuses me is open object types. Can the open
> object type < one : int; .. > be defined directly in any way ?
>
> type foo = < one : int; .. >
Yes, but since this is a polymorphic type you have to write:
type 'a foo = 'a constraint 'a = < one : int; ..>;;
This captures the polymorphic row variable `..' (that you are not allowed to
name directly) within the constrained type parameter 'a.
Didier.
next prev parent reply other threads:[~1999-02-18 12:21 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-02-12 20:53 Christopher Jeris
1999-02-16 10:57 ` Anton Moscal
1999-02-17 9:32 ` Xavier Leroy
1999-02-17 18:09 ` Christopher Jeris
1999-02-17 19:14 ` Didier Remy [this message]
1999-02-22 8:44 ` Anton Moscal
1999-02-22 13:00 ` Pierre Weis
1999-02-15 10:30 Don Syme
1999-02-15 18:03 Manuel Fahndrich
1999-02-16 17:40 Don Syme
1999-02-18 10:13 Frank A. Christoph
1999-02-18 14:03 Don Syme
1999-02-22 16:37 Manuel Fahndrich
1999-02-22 17:56 ` Pierre Weis
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=19990217201403.48891@morgon.inria.fr \
--to=remy@morgon.inria.fr \
--cc=Didier.Remy@inria.fr \
--cc=Xavier.Leroy@inria.fr \
--cc=caml-list@inria.fr \
--cc=cjeris@math.mit.edu \
/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