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 EAA18036; Mon, 11 Aug 2003 04:46:28 +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 EAA19257 for ; Mon, 11 Aug 2003 04:46:26 +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 h7B2kOf12821 for ; Mon, 11 Aug 2003 04:46:24 +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 LAA04394; Mon, 11 Aug 2003 11:46:16 +0900 (JST) To: skaller@ozemail.com.au Cc: caml-list@inria.fr Subject: Re: [Caml-list] tpyping question In-Reply-To: <1060564412.7474.11.camel@localhost.localdomain> References: <1060564412.7474.11.camel@localhost.localdomain> 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: <20030811114615Y.garrigue@kurims.kyoto-u.ac.jp> Date: Mon, 11 Aug 2003 11:46:15 +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 ozemail:01 compiles:01 bug:01 val:01 or-patterns:01 int:01 garrigue:01 match:02 float:02 meaningless:03 let:04 seems:05 equivalent:05 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk From: skaller > type x = [`A | `B of int | `V of float];; > let g (a:x) = a;; > let f a = match a with > | `A -> g a > (* | `B _ *) | _ -> g a;; > > Compiles fine, but gives an error if the comments are > removed. Indeed, there seems to be a bug here, since the non-commented version should be equivalent to # let f a = match a with | `A -> g a | `B _ -> g a | _ -> g a;; val f : x -> x = I will investigate this. On the other hand, this code is meaningless, as _ is more general than `B _, and the order of or-patterns is not significant. If the code you really intended was let f a = match a with | `A -> g a | `B _ -> g a then the answer is in the manual: let f = function `A | `B _ as a -> g a 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