From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id VAA10451 for caml-redistribution@pauillac.inria.fr; Wed, 3 Nov 1999 21:41:37 +0100 (MET) Resent-Message-Id: <199911032041.VAA10451@pauillac.inria.fr> Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id TAA11481 for ; Fri, 29 Oct 1999 19:45:31 +0200 (MET DST) Received: from postbox.dai.ed.ac.uk (postbox.dai.ed.ac.uk [129.215.41.196]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id TAA16918 for ; Fri, 29 Oct 1999 19:45:29 +0200 (MET DST) Received: from pitcaple (pitcaple.dai.ed.ac.uk [129.215.41.229]) by postbox.dai.ed.ac.uk (8.9.3/8.9.3) with SMTP id SAA26687; Fri, 29 Oct 1999 18:45:01 +0100 (BST) Date: Fri, 29 Oct 1999 18:44:53 +0100 Message-Id: <14130.199910291744@pitcaple> From: William Chesters MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: caml-list@inria.fr Subject: Record typing question In-Reply-To: <39ADCF833E74D111A2D700805F1951EF1801426B@RED-MSG-06> References: <39ADCF833E74D111A2D700805F1951EF1801426B@RED-MSG-06> X-Mailer: VM 6.22 under Emacs 19.34.1 Resent-From: weis@pauillac.inria.fr Resent-Date: Wed, 3 Nov 1999 21:41:37 +0100 Resent-To: caml-redistribution@pauillac.inria.fr 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 = > > Why doesn't f have type 'a foo -> int foo??