Browse thread
Type annotations
[
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: | 2000-12-25 (21:58) |
From: | Pierre Weis <Pierre.Weis@i...> |
Subject: | Re: Ref syntax |
> >>>>> "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/