Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Sumtypes of records
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Marcin 'Qrczak' Kowalczyk <qrczak@k...>
Subject: Re: [Caml-list] Sumtypes of records
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 =
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

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: