caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: qrczak@knm.org.pl (Marcin 'Qrczak' Kowalczyk)
To: caml-list@inria.fr
Subject: Re: Ref syntax
Date: 22 Dec 2000 19:24:37 GMT	[thread overview]
Message-ID: <slrn947ajl.6e6.qrczak@qrnik.zagroda> (raw)
In-Reply-To: <200012220907.KAA16920@pauillac.inria.fr>

Fri, 22 Dec 2000 10:07:07 +0100 (MET), Pierre Weis <Pierre.Weis@inria.fr> 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



  parent reply	other threads:[~2000-12-25 21:10 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 [this message]
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

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=slrn947ajl.6e6.qrczak@qrnik.zagroda \
    --to=qrczak@knm.org.pl \
    --cc=caml-list@inria.fr \
    /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).