English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Record typing question
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 1999-10-29 (17:21)
From: Don Syme <dsyme@m...>
Subject: Record typing question

The typing rule for record overriding seems slightly more restrictive than
necessary, though I can imagine this is because it was simplest to implement
it this way.  e.g.

# type 'a foo = { a: 'a; b: int };;
type 'a foo = { a: 'a; b:int }
# let f x = {x with a=1 };;
val f : int foo -> int foo = <fun>

Why doesn't f have type 'a foo -> int foo??

It's not a big deal, since I can always construct a whole new record term,
but there may be an easy fix.  BTW adding record overriding in 2.02 has
saved me _heaps_ of time, and made it much more productive to use records.