caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Same name fields
@ 2009-11-21 15:32 Mykola Stryebkov
  2009-11-21 15:51 ` [Caml-list] " Goswin von Brederlow
  2009-11-21 15:55 ` David Allsopp
  0 siblings, 2 replies; 3+ messages in thread
From: Mykola Stryebkov @ 2009-11-21 15:32 UTC (permalink / raw)
  To: caml-list

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






^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-11-21 15:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-21 15:32 Same name fields Mykola Stryebkov
2009-11-21 15:51 ` [Caml-list] " Goswin von Brederlow
2009-11-21 15:55 ` David Allsopp

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).