From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 7958ABBAF for ; Sat, 21 Nov 2009 16:33:05 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Aq8EADaXB0s+lQkY/2dsb2JhbACBTdIKhDwEgXCHDw X-IronPort-AV: E=Sophos;i="4.47,264,1257116400"; d="scan'208";a="38509621" Received: from colo9-24.users.colocall.net (HELO dragon.mykola.org) ([62.149.9.24]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 21 Nov 2009 16:33:05 +0100 Received: from [192.168.0.157] (SOL-FTTB.16.85.27.94.sovam.net.ua [94.27.85.16] (may be forged)) (authenticated bits=0) by dragon.mykola.org (8.14.3/8.14.3) with ESMTP id nALFX2in017344 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) for ; Sat, 21 Nov 2009 17:33:03 +0200 (EET) (envelope-from nick@mykola.org) Message-Id: From: Mykola Stryebkov To: caml-list@inria.fr Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v936) Subject: Same name fields Date: Sat, 21 Nov 2009 17:32:58 +0200 X-Mailer: Apple Mail (2.936) X-Spam: no; 0.00; printf:01 printf:01 compiler:01 bug:01 pubkey:01 blog:98 blog:98 bce:98 int:01 int:01 expression:02 string:02 string:02 workaround:03 float:03 Hi, I'm trying to declare to record types with fields having the same name but different types. Something like this: ======================================================================== type ta = { a : int; b : string } type tb = { a : float; b : string list } let f v = Printf.printf "%d\n" v.a ======================================================================== Compiler says I have an error in the line with Printf: This expression has type float but is here used with type int If I declare type ta second - everything works fine. Is it a bug? If not, what is an appropriate workaround here? Thanks in advance. -- Mykola Stryebkov Blog: http://mykola.org/blog/ Public key: http://mykola.org/pubkey.txt fpr: 0226 54EE C1FF 8636 36EF 2AC9 BCE9 CFC7 9CF4 6747