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 SAA22543; Mon, 28 Jul 2003 18:35:21 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 SAA28190 for ; Mon, 28 Jul 2003 18:35:19 +0200 (MET DST) Received: from relay.pair.com (relay.pair.com [209.68.1.20]) by nez-perce.inria.fr (8.11.1/8.11.1) with SMTP id h6SGZIT03348 for ; Mon, 28 Jul 2003 18:35:18 +0200 (MET DST) Received: (qmail 4082 invoked from network); 28 Jul 2003 16:35:15 -0000 Received: from arda.pair.com (HELO checkerdell.d6.com) (209.68.1.133) by relay.pair.com with SMTP; 28 Jul 2003 16:35:15 -0000 X-pair-Authenticated: 209.68.1.133 Message-Id: <4.3.2.7.2.20030728092556.02f23270@localhost> X-Sender: checker@localhost X-Mailer: QUALCOMM Windows Eudora Version 4.3.2 Date: Mon, 28 Jul 2003 09:35:15 -0700 To: Jacques Garrigue From: Chris Hecker Subject: Re: [Caml-list] naming parts of optional arguments? Cc: caml-list@inria.fr In-Reply-To: <20030728161851Y.garrigue@kurims.kyoto-u.ac.jp> References: <4.3.2.7.2.20030727203156.0240ddd0@localhost> <4.3.2.7.2.20030327170847.04102fc0@localhost> <4.3.2.7.2.20030327180749.03282978@localhost> <4.3.2.7.2.20030727203156.0240ddd0@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Loop: caml-list@inria.fr X-Spam: no; 0.00; hecker:01 checker:01 caml-list:01 val:01 chris:01 inconsistent:01 int:01 syntax:02 thread:02 unit:03 variable:03 arguments:03 let:04 defining:04 parameters:05 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk >No contradiction at all: ?xy: is a label, not a variable name. Well, except for in this case, of course, when it is a variable name: # let f ?xy () = xy;; val f : ?xy:'a -> unit -> 'a option = >If you care about length, you can still write: > let f ?(xy=(0,0)) () = xy No, because I need to break out the parts of the tuple and name the whole tuple, which was the point of the thread, so the only way to do that I can see is this beautiful expression: # let f ?xy:((x,y) as xy = 0,0) () = xy,x,y;; val f : ?xy:int * int -> unit -> (int * int) * int * int = All I'm saying is that having the first example above work leads one to believe the xy is usable inside the function body in general. On the whole, the syntax for defining default parameters is nonintuitive and inconsistent, because you need the parenthesis sometimes, you need the "as xy" sometimes, you need the ?label: sometimes, etc. Chris ------------------- 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