caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Pierre Weis <Pierre.Weis@inria.fr>
To: jmp@arsdigita.com (John Prevost)
Cc: caml-list@inria.fr
Subject: Re: Ref syntax
Date: Mon, 25 Dec 2000 22:58:36 +0100 (MET)	[thread overview]
Message-ID: <200012252158.WAA31733@pauillac.inria.fr> (raw)
In-Reply-To: <87k88sm0nu.fsf@elbereth.pgh.arsdigita.com> from John Prevost at "Dec 22, 100 04:39:01 pm"

> >>>>> "mk" == Marcin 'Qrczak' Kowalczyk <qrczak@knm.org.pl> writes:
> 
>     mk> The only consistent syntax would be "!x <-
>     mk> new_contents_of_x". Note that the revised syntax uses "x.val
>     mk> <- new_contents_of_x", with x.val being equivalent to old !x
>     mk> on both sides of <- and without the need of any magic syntax
>     mk> for references in addition to what is available anyway for
>     mk> mutable fields.
> 
> Of course, in the standard syntax you can write "x.contents <- 1" in
> the same way.  Though that's quite a bit more verbose.
> 
> John.

This is already possible in the current version of Objective Caml.

        Objective Caml version 3.00

# let x = ref 2;;
val x : int ref = {contents=2}
# x.contents;;
- : int = 2
# x.contents <- 1;;
- : unit = ()

If you don't like operators ! and :=, just don't use them, and use the
regular filed acces instead!

Merry Christmas,

Pierre Weis

INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis/




      reply	other threads:[~2000-12-25 21:58 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-12-14 14:12 Type annotations Ohad Rodeh
2000-12-15  2:25 ` Jacques Garrigue
2000-12-21 12:50 ` Ref syntax Ohad Rodeh
2000-12-22  3:29   ` Jacques Garrigue
2000-12-22  8:45     ` Sven LUTHER
2000-12-23  0:30       ` John Prevost
2000-12-22  9:07     ` Pierre Weis
2000-12-22  9:30       ` Jacques Garrigue
2000-12-22 14:22         ` Pierre Weis
2000-12-22 19:24       ` Marcin 'Qrczak' Kowalczyk
2000-12-22  9:17     ` Pascal Brisset
2000-12-23  0:37       ` John Prevost
2000-12-22 16:40   ` Marcin 'Qrczak' Kowalczyk
2000-12-23  0:39     ` John Prevost
2000-12-25 21:58       ` Pierre Weis [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=200012252158.WAA31733@pauillac.inria.fr \
    --to=pierre.weis@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=jmp@arsdigita.com \
    /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).