From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id PAA13074; Sat, 17 May 2003 15:26:47 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 PAA12970 for ; Sat, 17 May 2003 15:26:46 +0200 (MET DST) Received: from qrnik.knm.org.pl (paf87.warszawa.sdi.tpnet.pl [217.96.225.87]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h4HDQhT12298 for ; Sat, 17 May 2003 15:26:45 +0200 (MET DST) Received: from localhost ([127.0.0.1] ident=qrczak) by qrnik.knm.org.pl with esmtp (Exim 3.36 #1) id 19H1hw-0003b2-00 for caml-list@inria.fr; Sat, 17 May 2003 15:26:40 +0200 From: "Marcin 'Qrczak' Kowalczyk" To: caml-list@inria.fr Subject: Re: [Caml-list] Sumtypes of records Date: Sat, 17 May 2003 15:26:39 +0200 User-Agent: KMail/1.5.1 References: <003e01c31645$2bfa3c00$e50e76d5@j> <4.3.2.7.2.20030516182821.042f6dd0@localhost> In-Reply-To: <4.3.2.7.2.20030516182821.042f6dd0@localhost> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: 8bit Message-Id: <200305171526.39769.qrczak@knm.org.pl> X-Spam: no; 0.00; marcin:01 'qrczak':01 kowalczyk:01 qrczak:01 caml-list:01 hecker:01 foo:01 ocaml's:01 haskell:01 statically:01 dynamically:01 inference:01 chris:01 overloading:01 int:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Dnia sob 17. maja 2003 03:35, Chris Hecker napisał: > It has type { age : int; }, just like int * int has type int * int and > doesn't need a name. Does the record need a name for some other reason? let foo x = x.bar What is the type of foo if there is no named record in scope having field bar? I don't say that I like it but it's a consequence of the OCaml's type system. Haskell has that too (but theoretically type classes could be made to help). SML is what you would like; it has sort of overloading of certain builtin operations and in this case requires the type of x to be statically known somehow. There is no problem with dynamically typed languages, and "non-functional" statically typed ones require to explicitly write the type of bound variables anyway. Having the same field name in various record types just doesn't mix well with type inference. -- __("< Marcin Kowalczyk \__/ qrczak@knm.org.pl ^^ http://qrnik.knm.org.pl/~qrczak/ ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners