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 XAA20604; Wed, 13 Nov 2002 23:40:16 +0100 (MET) 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 XAA21115 for ; Wed, 13 Nov 2002 23:40:15 +0100 (MET) Received: from plinky.bolt-action.com (node-d8e9cca3-sfo-onnet.worldcom.com [216.233.204.163]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id gADMeD111136 for ; Wed, 13 Nov 2002 23:40:14 +0100 (MET) Received: from CHECKERATH (node-d8e9cca2-sfo-onnet.worldcom.com [216.233.204.162]) by plinky.bolt-action.com (8.11.6/8.9.3) with SMTP id gADNXON14954 for ; Wed, 13 Nov 2002 15:33:24 -0800 Date: Wed, 13 Nov 2002 15:33:24 -0800 Message-Id: <200211132333.gADNXON14954@plinky.bolt-action.com> From: Chris Hecker To: caml-list@inria.fr Subject: [Caml-list] labels and optional arguments in 3.06 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk The new optional label semantics seem to work pretty well for my normal usage, however I've run across one thing I'd like to do that doesn't seem to work (and a warning I don't understand): > # let f ?(a = 1.0) ~b ~c = a *. b *. c;; > Characters 12-15: > Warning: This optional argument cannot be erased > let f ?(a = 1.0) ~b ~c = a *. b *. c;; > ^^^ > val f : ?a:float -> b:float -> c:float -> float = First question: what is this warning? Second question: I'd like to be able to call f with or without specifying the optional argument, without labels: > # f;; > - : ?a:float -> b:float -> c:float -> float = > # f 2.0 4.0;; > - : float = 8. works fine, > # f ~a:2.0 2.0 4.0;; > Characters 9-12: > f ~a:2.0 2.0 4.0;; > ^^^ > Expecting function has type b:float -> c:float -> float > This argument cannot be applied without label doesn't work. I'd like to be able to use ~b and ~c for interface documentation, but not be forced to use them, and have ?a be an optional parameter. This > # f ~a:2.0 ~b:2.0 ~c:4.0;; > - : float = 16. works, of course, but it's really verbose. Is there any way to make this work? 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