From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id JAA00782; Mon, 28 Jul 2003 09:19:00 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 JAA09002 for ; Mon, 28 Jul 2003 09:18:58 +0200 (MET DST) Received: from kurims.kurims.kyoto-u.ac.jp (kurims.kurims.kyoto-u.ac.jp [130.54.16.1]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h6S7Iuf27226 for ; Mon, 28 Jul 2003 09:18:57 +0200 (MET DST) Received: from localhost (suiren.kurims.kyoto-u.ac.jp [130.54.16.25]) by kurims.kurims.kyoto-u.ac.jp (8.9.3p2/3.7W) with ESMTP id QAA07000; Mon, 28 Jul 2003 16:18:51 +0900 (JST) To: checker@d6.com Cc: caml-list@inria.fr Subject: Re: [Caml-list] naming parts of optional arguments? In-Reply-To: <4.3.2.7.2.20030727203156.0240ddd0@localhost> References: <4.3.2.7.2.20030327170847.04102fc0@localhost> <4.3.2.7.2.20030327180749.03282978@localhost> <4.3.2.7.2.20030727203156.0240ddd0@localhost> X-Mailer: Mew version 1.94.2 on Emacs 21.2 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20030728161851Y.garrigue@kurims.kyoto-u.ac.jp> Date: Mon, 28 Jul 2003 16:18:51 +0900 From: Jacques Garrigue X-Dispatcher: imput version 20000228(IM140) X-Loop: caml-list@inria.fr X-Spam: no; 0.00; jacques:01 caml-list:01 hecker:01 checker:01 val:01 chris:01 blah:01 int:01 garrigue:01 thread:02 unbound:02 unit:03 variable:03 arguments:03 let:04 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk From: Chris Hecker Date: Sun, 27 Jul 2003 20:41:57 -0700 > [old thread resurrected] Very old indeed. > Actually, I spoke too soon below, you have to have the "as xy" on there to > be able to reference the tuple by xy. Doesn't that seem redundant given > the ?xy: specification (which doesn't seem to be used)? > > # let f ?xy:((x,y)=(0,0)) () = x + y;; > val f : ?xy:int * int -> unit -> int = > # let f ?xy:((x,y)=(0,0)) () = xy;; > Characters 29-31: > let f ?xy:((x,y)=(0,0)) () = xy;; > ^^ > Unbound value xy > # let f ?xy:((x,y) as xy =(0,0)) () = xy;; > val f : ?xy:int * int -> unit -> int * int = > # let f ?xy:((x,y) as blah =(0,0)) () = blah;; > val f : ?xy:int * int -> unit -> int * int = No contradiction at all: ?xy: is a label, not a variable name. If you care about length, you can still write: let f ?(xy=(0,0)) () = xy The distinction between label and variable is useful to avoid masking the environment. let x = ref 3 let f ?x:(x' = !x + 1) () = x := x' Jacques Garrigue ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners