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 IAA04748 for caml-red; Fri, 22 Dec 2000 08:33:39 +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 EAA22988 for ; Fri, 22 Dec 2000 04:30:01 +0100 (MET) Received: from kurims.kurims.kyoto-u.ac.jp (kurims.kurims.kyoto-u.ac.jp [130.54.16.1]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id eBM3Tw901569 for ; Fri, 22 Dec 2000 04:29:59 +0100 (MET) Received: from localhost (mikan.kurims.kyoto-u.ac.jp [130.54.16.202]) by kurims.kurims.kyoto-u.ac.jp (8.9.3/3.7W) with ESMTP id MAA17045; Fri, 22 Dec 2000 12:29:38 +0900 (JST) To: orodeh@cs.huji.ac.il Cc: caml-list@inria.fr Subject: Re: Ref syntax In-Reply-To: References: X-Mailer: Mew version 1.94.2 on Emacs 20.7 / Mule 4.0 (HANANOEN) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20001222122938T.garrigue@kurims.kyoto-u.ac.jp> Date: Fri, 22 Dec 2000 12:29:38 +0900 From: Jacques Garrigue X-Dispatcher: imput version 20000228(IM140) Sender: weis@pauillac.inria.fr From: Ohad Rodeh > 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 JG