caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jacques Garrigue <garrigue@kurims.kyoto-u.ac.jp>
To: orodeh@cs.huji.ac.il
Cc: caml-list@inria.fr
Subject: Re: Ref syntax
Date: Fri, 22 Dec 2000 12:29:38 +0900	[thread overview]
Message-ID: <20001222122938T.garrigue@kurims.kyoto-u.ac.jp> (raw)
In-Reply-To: <Pine.LNX.4.20_heb2.08.0012211444520.26395-100000@zigzag.cs.huji.ac.il>

From: Ohad Rodeh <orodeh@cs.huji.ac.il>

>   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? 

Sorry, but this does not work: this may be confused with record assignment.

       type t = {mutable x : int ref};;
       let r = {x = ref 1};;
       r.x <- ref 2;;
       r.x := 3;;

So here is also my wishlist for Santa Xavier.

* addition of let mutable ... in
       let mutable x = 0 in
       for i = 1 to do x <- x + i done;
       x
  The idea is to have references which are certified not to be
  returned or passed to functions. Easy.
  Makes lots of thing clearer, but it might be a good idea to allow
  only the let ... in form, since toplevel let mutable is rather
  opposed to functional programming.

* addition of let open ... in
       module P2d = struct type t = {x:int;y:int} end
       module P3d = struct type t = {x:int;y:int;z:int} end
       let f2d p1 p2 =
         let open P2d in
         {x = p1.x + p2.x; y = p1.y + p2.y}
  Extremely easy.

* allow #labels in programs
  avoids subtle makefiles when you have both files with and without
  labels, also avoid to check the mode before compiling a file.

* have a notation to abbreviate the OCAMLLIB directory in include
  paths. One could write
       ocamlc -c -I +labltk -I +lablGL gears.ml
  rather than
       ocamlc -c -I `ocamlc -where`/labltk -I `ocamlc -where`/lablgGL gears.ml

I would be already satisfied with only one of these...

Cheers,

Jacques
---------------------------------------------------------------------------
Jacques Garrigue      Kyoto University     garrigue at kurims.kyoto-u.ac.jp
		<A HREF=http://wwwfun.kurims.kyoto-u.ac.jp/~garrigue/>JG</A>



  reply	other threads:[~2000-12-22  7:33 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 [this message]
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
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=20001222122938T.garrigue@kurims.kyoto-u.ac.jp \
    --to=garrigue@kurims.kyoto-u.ac.jp \
    --cc=caml-list@inria.fr \
    --cc=orodeh@cs.huji.ac.il \
    /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).