From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id WAA24474 for caml-red; Mon, 25 Dec 2000 22:58:54 +0100 (MET) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id WAA02132 for ; Mon, 25 Dec 2000 22:58:39 +0100 (MET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id eBPLwaP26854; Mon, 25 Dec 2000 22:58:36 +0100 (MET) Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id WAA31733; Mon, 25 Dec 2000 22:58:36 +0100 (MET) From: Pierre Weis Message-Id: <200012252158.WAA31733@pauillac.inria.fr> Subject: Re: Ref syntax In-Reply-To: <87k88sm0nu.fsf@elbereth.pgh.arsdigita.com> from John Prevost at "Dec 22, 100 04:39:01 pm" To: jmp@arsdigita.com (John Prevost) Date: Mon, 25 Dec 2000 22:58:36 +0100 (MET) Cc: caml-list@inria.fr X-Mailer: ELM [version 2.4ME+ PL28 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: weis@pauillac.inria.fr > >>>>> "mk" == Marcin 'Qrczak' Kowalczyk 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/