From: Andreas Rossberg <rossberg@mpi-sws.org>
To: Andrej Bauer <Andrej.Bauer@andrej.com>
Cc: caml <caml-list@inria.fr>
Subject: Re: [Caml-list] Proposal for extensible open datatypes
Date: Fri, 6 Jan 2012 09:56:21 +0100 [thread overview]
Message-ID: <8ED26AE5-A208-49A2-A8CD-43F22E969FF9@mpi-sws.org> (raw)
In-Reply-To: <CAB0nkh3X0zKANrgLm6NFrDVajtRxcxM=DgCe+PN66P9niog79w@mail.gmail.com>
On Jan 6, 2012, at 07.26 h, Andrej Bauer wrote:
> I would be interested to hear what propeties of Ocaml you had to give
> up to get this interesting extension working? For example, what
> happens with checking for exhaustivness of match? Caml performs
> various optimizations in pattern matching, why are those still ok now
> that new alternatives may appear later?
One such type is already in ML, for historical reasons it happens to
be named exn. Consequently, you don't really give up anything, your
questions already apply to the exception type. Exhaustiveness simply
requires a catch-all in all pattern matches over this type. More
difficult is irredundancy, because constructors can be aliased without
the type system tracking that (and it cannot across module
boundaries). You have to give up there.
Generalising exn this way is an old idea, e.g. we implemented it in
Alice ML. The standard reply to requesting such an extension is that
it's not really needed, because you can already do everything using
exn (though without custom type distinctions, and minus GADTs in OCaml).
/Andreas
next prev parent reply other threads:[~2012-01-06 8:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-06 0:32 Leo P White
2012-01-06 6:26 ` Andrej Bauer
2012-01-06 8:56 ` Andreas Rossberg [this message]
2012-01-06 9:24 ` Leo P 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=8ED26AE5-A208-49A2-A8CD-43F22E969FF9@mpi-sws.org \
--to=rossberg@mpi-sws.org \
--cc=Andrej.Bauer@andrej.com \
--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