caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: William Chesters <williamc@dai.ed.ac.uk>
To: caml-list@inria.fr
Subject: Record typing question
Date: Fri, 29 Oct 1999 18:44:53 +0100	[thread overview]
Message-ID: <14130.199910291744@pitcaple> (raw)
In-Reply-To: <39ADCF833E74D111A2D700805F1951EF1801426B@RED-MSG-06>

Spooky, I raised this point a few days ago!

There is a slight complication, because of cases like

    type 'a foo = { a: 'a; b: 'a }
    let f x = { x with a = 1 }

    let _ = f { a: "one"; b: "one" }

Here "f: 'a foo -> int foo" won't wash, because the "b" field will
stay an int, contra the definition.  Before lifting the current
restriction, one would have to check that no type equalities between
fields are broken.

Nevertheless, I don't see a problem in principle and it would be good
to see a more general version.

Don Syme writes:
 > 
 > The typing rule for record overriding seems slightly more restrictive than
 > necessary, though I can imagine this is because it was simplest to implement
 > it this way.  e.g.
 > 
 > # type 'a foo = { a: 'a; b: int };;
 > type 'a foo = { a: 'a; b:int }
 > # let f x = {x with a=1 };;
 > val f : int foo -> int foo = <fun>
 > 
 > Why doesn't f have type 'a foo -> int foo??



  reply	other threads:[~1999-11-03 20:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-10-29 13:25 Don Syme
1999-10-29 17:44 ` William Chesters [this message]
1999-11-04 14:30 Don Syme

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=14130.199910291744@pitcaple \
    --to=williamc@dai.ed.ac.uk \
    --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;
as well as URLs for NNTP newsgroup(s).