Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Donald Syme <Donald.Syme@cl.cam.ac.uk>
To: caml-list@pauillac.inria.fr
Subject: Non-destructive record update??
Date: Wed, 15 Apr 1998 00:27:20 +0100	[thread overview]
Message-ID: <E0yPF6q-00084I-00@heaton.cl.cam.ac.uk> (raw)
In-Reply-To: Your message of "Thu, 09 Apr 1998 17:02:05 +0200." <199804091502.RAA14646@pauillac.inria.fr>


[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
-----------------------------------------------------------------------------







  reply	other threads:[~1998-04-15  9:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-04-09 15:02 Caml sur Rhapsody Pierre Weis
1998-04-14 23:27 ` Donald Syme [this message]
1998-04-25 11:26   ` Non-destructive record update?? Christophe Raffalli
1998-04-16 14:19     ` Pierre Weis
1998-04-16 14:47       ` Pascal Brisset
1998-04-17  0:26       ` Jacques GARRIGUE

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E0yPF6q-00084I-00@heaton.cl.cam.ac.uk \
    --to=donald.syme@cl.cam.ac.uk \
    --cc=caml-list@pauillac.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox