caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Pierre Weis <weis@pauillac.inria.fr>
To: garrigue@kurims.kyoto-u.ac.jp (Jacques Garrigue)
Cc: caml-list@pauillac.inria.fr
Subject: Re: Ref syntax
Date: Fri, 22 Dec 2000 15:22:50 +0100 (MET)	[thread overview]
Message-ID: <200012221422.PAA27513@pauillac.inria.fr> (raw)
In-Reply-To: <20001222183020R.garrigue@kurims.kyoto-u.ac.jp> from Jacques Garrigue at "Dec 22, 100 06:30:20 pm"

> Really, I don't think it would be useful at toplevel.
> I view let mutable .. in as a way to provide some state, but
> immediately cleanly wrapped, either by only being used locally, or
> in exported functions.
> This is completely similar to mutable object fields; both the goal and
> the method.

I hope this is effectively simple to type check, and ensure correct.

> > For instance, what do we
> > do if such a letref variable is assigned to, from within the body of a
> > function (that could be exported) ?
> 
> This is just syntactic sugar for references, which is why I said it
> was easy. Similarly typing is just the typing of references.

So you mean, that if we define x with let mutable x = 1, the variable
x has in fact type int ref ?

> > Furthermore, this construct would add an entirely
> > new notion to Caml: lvalues.
> 
> As stated above: they are already here, object fields.
> You may think of it as a good or bad idea, but the distinction
> between it and the fact a.x behaves differently when there is a <- and
> when there is none is subtle.

Sorry, but for field mutations the syntactic construct is not
 expr <- new_val
but
 expr.label <- new_val
which is semantically assign_to_label (expr, new_val), as
 expr.(i) <- new_val
is a short-hand for assign_to_vector (expr, i, new_val).

In both constructs there is no notion of left values.

I really don't know if the corresponding notion for objects needs
lvalues or not.

> But well, this was only first in my wish list because I was answering
> to a message related to that. My personal priority is much lower.

I think exactly the same: the let mutable (or var construct as we used
to call it) is desirable, but may not be worth the implementation
effort.

[...]
> > So you are already satisfied, since you can write
> > 
> >   ocamlc -c -I +camltk -I +camlimages ocaml_unreal_t.ml
> > 
> > in the current development version!
> 
> Great! I had seen the introduction of -where, but didn't catch this
> one.
> Thanks, Papa Weis !
> 
> Jacques

Hey, this is your ``Santa Xavier's'' work. Thanks to him.

Cheers,

Pierre Weis

INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis/




  reply	other threads:[~2000-12-22 14:25 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 [this message]
2000-12-22 19:24       ` Marcin 'Qrczak' Kowalczyk
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=200012221422.PAA27513@pauillac.inria.fr \
    --to=weis@pauillac.inria.fr \
    --cc=caml-list@pauillac.inria.fr \
    --cc=garrigue@kurims.kyoto-u.ac.jp \
    /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).