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 WAA04708 for caml-red; Mon, 25 Dec 2000 22:10:50 +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 UAA17610 for ; Fri, 22 Dec 2000 20:26:29 +0100 (MET) Received: from mail.mimuw.edu.pl (pm86.warszawa.cvx.ppp.tpnet.pl [213.76.108.86]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id eBMJPD911710 for ; Fri, 22 Dec 2000 20:26:15 +0100 (MET) Received: (from news@localhost) by mail.mimuw.edu.pl (PLD/8.9.3) id UAA06644 for caml-list@inria.fr; Fri, 22 Dec 2000 20:24:40 +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 19:24:37 GMT Organization: Klub Nieszkodliwych =?iso-8859-2?Q?Manjak=F3w?= Message-ID: References: <200012220907.KAA16920@pauillac.inria.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2 Content-Transfer-Encoding: 8bit X-Trace: qrnik.zagroda 977513077 6642 192.168.0.1 (22 Dec 2000 19:24:37 GMT) X-Complaints-To: news@qrnik.zagroda NNTP-Posting-Date: 22 Dec 2000 19:24:37 GMT User-Agent: slrn/0.9.6.3 (Linux) To: caml-list@inria.fr Sender: weis@pauillac.inria.fr Fri, 22 Dec 2000 10:07:07 +0100 (MET), Pierre Weis pisze: > Furthermore, this construct would add an entirely new notion to > Caml: lvalues. It would not necessarily cause troubles. "let mutable x = init_value in expr" would be equivalent to "let ref_x = ref init_value in expr", where x is a *macro* visible inside expr, expanding to ref_x.contents in all contexts, before desugaring expressions of the form variable.field <- something. So for example "let y = x in ..." placed inside expr would bind the snapshot of x's value to y, and "let y () = x in ..." would create a function which retrieves the current x's value each time it is called. No more confusing than usual eager evaluation order. There is no direct access to ref_x itself. IMHO it's perfectly consistent with mutable record fields. -- __("< Marcin Kowalczyk * qrczak@knm.org.pl http://qrczak.ids.net.pl/ \__/ ^^ SYGNATURA ZASTĘPCZA QRCZAK