[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Donald Syme <Donald.Syme@c...> |
| Subject: | Non-destructive record update?? |
[Sorry - wrong subject on previous message]
I think O'Caml is absolutely excellent in general, but
why doesn't it have some form of non-destructive record
field update, as in
type x = {y : int};;
let x = {y=1};;
(x.y <- 2).y = 2;; (* true *)
x.y = 1;; (* true *)
???? (well, at least I haven't found it if it does...)
If I have N fields in my records, and if I need non-destructive update
because I'm actually writing things functionally (rather common in
a functional language), then I end up writing N*N lines worth of
non-destructive update functions myself - yeach!
Thanks in advance,
Don Syme
--
-----------------------------------------------------------------------------
At the lab: At home:
The Computer Laboratory Trinity Hall
New Museums Site CB2 1TJ
University of Cambridge Cambridge, UK
CB2 3QG, Cambridge, UK
Ph: +44 (0) 1223 334688
http://www.cl.cam.ac.uk/users/drs1004/
email: drs1004@cl.cam.ac.uk
-----------------------------------------------------------------------------