From: Chet Murthy <murthy.chet@gmail.com>
To: Jeremy Yallop <yallop@gmail.com>
Cc: Oleg <oleg@okmij.org>, Caml List <caml-list@inria.fr>
Subject: Re: [Caml-list] Are record types generative?
Date: Tue, 23 Jan 2018 13:36:37 -0800 [thread overview]
Message-ID: <CA++P_gcLGJA5whF41KiP++SHgabGvue4bJd1gPf233tGP6NfWQ@mail.gmail.com> (raw)
In-Reply-To: <CAAxsn=EqdT3j5GT8izqfitFsC9Jucsibaj+Gw8YVScaMCpN+TA@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1671 bytes --]
Heh. I was careful to say "caml", not "ocaml". I'm aware that polymorphic
variants, objects, and (heh, I forgot) labels all violate the rule. And of
course, modules do.
Like I said: *caml* has this property. Certainly caml-light, circa 1993
did, IIRC.
I remember having a nice discussion with Pierre Weis, where I asked him why
record-labels were generative, and he pointed this out to me.
--chet--
On Tue, Jan 23, 2018 at 12:35 PM, Jeremy Yallop <yallop@gmail.com> wrote:
> On 23 January 2018 at 17:39, Chet Murthy <murthy.chet@gmail.com> wrote:
> > That is, when you write a caml program and it fails to type-check, you
> can't make it type-check by adding "enough" type-annotations.
>
> This hasn't been the case for a long time (perhaps ever), and it's
> becoming less true with each release. For example, all of the
> following programs pass type checking as written, but are rejected if
> the annotations are removed:
>
> (* 1 *) let f (g : x:int -> y:int -> int) x y = (g ~x ~y, g ~y ~x)
> (* 2 *) let rec f : 'a. 'a -> unit = fun x -> ignore (f 3, f "four")
> (* 3 *) let f : [`A] -> unit = function `A -> () | _ -> .
> (* 4 *) module type S = module type of struct let r : int list
> ref = ref [] end
> (* 5 *) let f (o : <m:'a.'a -> unit>) = (o#m (), o#m 2)
> (* 6 *) let f z = let rec x = [| y; z |] and y : int = z in x
> (* 7 *) let x : _ format6 = "%d" in Printf.sprintf x
> (* 8 *) type a = A | B type b = A let x = (A : a) = B
> (* 9 *) let f : (module S) = (module struct end)
> (* 10 *) module rec M : module type of struct let f : int -> int =
> assert false end = struct let f = M.f end
>
[-- Attachment #2: Type: text/html, Size: 2341 bytes --]
next prev parent reply other threads:[~2018-01-23 21:36 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-23 14:54 Oleg
2018-01-23 16:05 ` Jeremy Yallop
2018-01-23 17:39 ` Chet Murthy
2018-01-23 20:35 ` Jeremy Yallop
2018-01-23 21:36 ` Chet Murthy [this message]
2018-01-23 22:06 ` Jeremy Yallop
2018-01-23 23:14 ` Hendrik Boom
2018-01-24 1:06 ` Chet Murthy
2018-01-24 1:35 ` Francois BERENGER
2018-02-07 2:00 ` [Caml-list] [ANN] first release of bst: a bisector tree implementation Francois BERENGER
2018-02-07 12:40 ` Ivan Gotovchits
2018-02-08 0:46 ` Francois BERENGER
2018-01-24 1:56 ` [Caml-list] Are record types generative? Yawar Amin
2018-01-25 10:49 ` Matej Košík
2018-01-25 13:39 ` Simon Cruanes
2018-01-25 16:24 ` Yawar Amin
2018-01-24 1:05 ` Chet Murthy
2018-01-24 8:43 ` Jacques Garrigue
2018-02-02 23:07 ` Toby Kelsey
2018-02-02 23:23 ` Evgeny Roubinchtein
2018-02-04 1:27 ` 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=CA++P_gcLGJA5whF41KiP++SHgabGvue4bJd1gPf233tGP6NfWQ@mail.gmail.com \
--to=murthy.chet@gmail.com \
--cc=caml-list@inria.fr \
--cc=oleg@okmij.org \
--cc=yallop@gmail.com \
/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