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 QAA31103; Thu, 15 Jul 2004 16:49:15 +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 QAA31063 for ; Thu, 15 Jul 2004 16:49:14 +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.12.10/8.12.10) with ESMTP id i6FEnCSH005385 for ; Thu, 15 Jul 2004 16:49:13 +0200 Received: from localhost (suiren.kurims.kyoto-u.ac.jp [130.54.16.25]) by kurims.kurims.kyoto-u.ac.jp (8.9.3p2-20030924/3.7W) with ESMTP id XAA20293; Thu, 15 Jul 2004 23:49:07 +0900 (JST) Date: Thu, 15 Jul 2004 23:49:07 +0900 (JST) Message-Id: <20040715.234907.125102370.garrigue@kurims.kyoto-u.ac.jp> To: rich@annexia.org Cc: caml-list@inria.fr Subject: Re: [Caml-list] Optional and mandatory labels with the same name in the same function ? From: Jacques GARRIGUE In-Reply-To: <20040715142305.GA14257@redhat.com> References: <20040715115433.GA29454@liafa.jussieu.fr> <20040715.231153.68538428.garrigue@kurims.kyoto-u.ac.jp> <20040715142305.GA14257@redhat.com> X-Mailer: Mew version 4.0.64 on Emacs 21.2 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 40F69968.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 jacques:01 3.07:01 ignores:01 val:01 val:01 bug:01 shorthand:01 runtime:01 unspecified:01 jacques:01 ocaml:01 ocaml:01 garrigue:01 garrigue:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk From: Richard Jones > It's a bit more subtle than that. OCaml 3.07 always picks the last > argument, and ignores the others. Thus: > > # let f x x = x;; > val f : 'a -> 'b -> 'b = > # let f x x x x = x;; > val f : 'a -> 'b -> 'c -> 'd -> 'd = > > But a future version might pick the first argument, or one in the > middle, or one at random. I can't find any guarantee in the manual > that the behaviour won't change, so this might cause a bug. Well, it's not directly related to the question I was answering, but I can reassure you. This behaviour is well defined, because let f x x = x is no more than a shorthand for let f = fun x -> fun x -> x which is quite natural for anybody versed in lambda-calculus. I cannot cite you whre the manual specifies that, but this not a case of undefined behaviour. More generally, ocaml may leave some runtime behaviour unspecified, but the static behaviour (type-checking) is expected to be fully specified. 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