caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
To: Create Software <createsoftware@users.sourceforge.net>
Cc: caml-list users <caml-list@inria.fr>
Subject: Re: [Caml-list] Pattern-matching on Ocaml records
Date: Mon, 2 May 2011 22:33:54 +0900	[thread overview]
Message-ID: <30BAF5B6-7829-4A50-950C-22AC03E65AFE@math.nagoya-u.ac.jp> (raw)
In-Reply-To: <4DBEAE90.9050506@users.sourceforge.net>

On 2011/05/02, at 22:16, Create Software wrote:

>> Only the record field itself is mutable. Extracting only gives you a value, not a reference.
> 
> Sure, but how come that
>    let reset {label = lbl} = lbl <- 0;;
> works fine in Caml Light and not in OCaml?

This has been deprecated.
Namely, this introduced a notion of lvalue, only for mutable record labels (and actually also for sum types IIRC).
The current approach of always requiring to specify the record is clearer, and it extends naturally the notations
   a.(i) <- e  for arrays
   s.[i] <- e  for strings

This said, later on object instance variables were added as lvalues, so the uniformity argument is not so strong...

Jacques Garrigue

      parent reply	other threads:[~2011-05-02 13:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-02 12:32 Create Software
2011-05-02 12:44 ` Andreas Rossberg
2011-05-02 13:16   ` Create Software
2011-05-02 13:24     ` Andreas Rossberg
2011-05-02 13:33     ` Jacques Garrigue [this message]

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=30BAF5B6-7829-4A50-950C-22AC03E65AFE@math.nagoya-u.ac.jp \
    --to=garrigue@math.nagoya-u.ac.jp \
    --cc=caml-list@inria.fr \
    --cc=createsoftware@users.sourceforge.net \
    /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;
as well as URLs for NNTP newsgroup(s).