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 SAA10342 for caml-red; Fri, 22 Dec 2000 18:07:27 +0100 (MET) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id RAA29948 for ; Fri, 22 Dec 2000 17:40:53 +0100 (MET) Received: from mail.mimuw.edu.pl (pm26.warszawa.cvx.ppp.tpnet.pl [213.76.108.26]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id eBMGeZ514773 for ; Fri, 22 Dec 2000 17:40:35 +0100 (MET) Received: (from news@localhost) by mail.mimuw.edu.pl (PLD/8.9.3) id RAA04695 for caml-list@inria.fr; Fri, 22 Dec 2000 17:40:30 +0100 X-Authentication-Warning: qrnik.zagroda: news set sender to qrczak@knm.org.pl (Marcin 'Qrczak' Kowalczyk) using -f From: qrczak@knm.org.pl (Marcin 'Qrczak' Kowalczyk) Subject: Re: Ref syntax Date: 22 Dec 2000 16:40:26 GMT Organization: Klub Nieszkodliwych =?iso-8859-2?Q?Manjak=F3w?= Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2 Content-Transfer-Encoding: 8bit X-Trace: qrnik.zagroda 977503226 4678 192.168.0.1 (22 Dec 2000 16:40:26 GMT) X-Complaints-To: news@qrnik.zagroda NNTP-Posting-Date: 22 Dec 2000 16:40:26 GMT User-Agent: slrn/0.9.6.3 (Linux) To: caml-list@inria.fr Sender: weis@pauillac.inria.fr Thu, 21 Dec 2000 14:50:38 +0200 (IST), Ohad Rodeh pisze: > I have a modest syntax request as we are approaching > the release of OCaml-3.01. Currently, if x is a > reference, one must use the assignment operator (:=) to > update it. Can array assignment (<-) be used also? It would be inconsistent. With <- the same "level of deredeferencing" is on both sides: "r.x <- r.x" is legal. With := the lhs is a reference and rhs is a dereferenced value, and the identity assignment is "x := !x". The only consistent syntax would be "!x <- new_contents_of_x". Note that the revised syntax uses "x.val <- new_contents_of_x", with x.val being equivalent to old !x on both sides of <- and without the need of any magic syntax for references in addition to what is available anyway for mutable fields. -- __("< Marcin Kowalczyk * qrczak@knm.org.pl http://qrczak.ids.net.pl/ \__/ ^^ SYGNATURA ZASTĘPCZA QRCZAK