Version française
Home     About     Download     Resources     Contact us    
Browse thread
Caml sur Rhapsody
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Christophe Raffalli <craff@l...>
Subject: Re: Non-destructive record update??

I completely agree with that.

You can end up with a messy program when you want to update record in a 
functional way. Moreover, if you add one field to a record type you have to 
modify your program for each updating even if they are unrelated with the new 
field !

The syntax could be

*   x.y <- 2 (may be confusing with mutable syntax ?)

*   let y = 2 in record x 

Or anything else, but there really should be something !

With the second syntax it is easy to extend the parser, 
and you could have a "and" to update more than one field, with only one copy
of the original record:

    let y = 2 and z = 3 in record x

 This is not the case with the straight forward compilation of:

    (x.y <- 2).z <- 3
   


-- 
Christophe Raffalli
Laboratoire de Mathématique / LAMA
Université de Savoie
UFR SFA, Campus Scientifique
73376, Le Bourget du Lac CEDEX, FRANCE.

URL: http://www.logique.jussieu.fr/www.raffalli
email: Christophe.Raffalli@univ-savoie.fr