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
Shallow copy of a record
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-01-22 (17:55)
From: Michal Moskal <michal.moskal@g...>
Subject: Re: [Caml-list] Shallow copy of a record
On Sat, 22 Jan 2005 11:55:19 -0500, Chris King <colanderman@gmail.com> wrote:
> On Sat, 22 Jan 2005 15:49:09 +0900 (JST), Jacques Garrigue
> <garrigue@math.nagoya-u.ac.jp> wrote:
> > This does not exist, and with good reason: there is no way in the type
> > system to define a function which works on all records, but only
> > records. So to do the copy you need to know at least one of the labels
> > of the record, which in turn gives you its type.
> Isn't it the foo in {foo with a=b} that determines the type, though?

No, consider:

  let copy foo = {foo with a = b}

and now, if there were no assign:

  let copy foo = {foo}

what should be the type of copy?

: Michal Moskal :: http://nemerle.org/~malekith/ :: GCS !tv h e>+++ b++
: No, I will *not* fix your computer............ :: UL++++$ C++ E--- a?