caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Mykola Stryebkov <nick@mykola.org>
To: caml-list@inria.fr
Subject: Same name fields
Date: Sat, 21 Nov 2009 17:32:58 +0200	[thread overview]
Message-ID: <A9B74EBD-2FDD-4705-BE61-90C75E813529@mykola.org> (raw)

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






             reply	other threads:[~2009-11-21 15:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-21 15:32 Mykola Stryebkov [this message]
2009-11-21 15:51 ` [Caml-list] " Goswin von Brederlow
2009-11-21 15:55 ` David Allsopp

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=A9B74EBD-2FDD-4705-BE61-90C75E813529@mykola.org \
    --to=nick@mykola.org \
    --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).