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 PAA21867; Mon, 5 Aug 2002 15:05:56 +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 PAA21911 for ; Mon, 5 Aug 2002 15:05:55 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g75D5sD24404; Mon, 5 Aug 2002 15:05:54 +0200 (MET DST) Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id PAA22009; Mon, 5 Aug 2002 15:05:54 +0200 (MET DST) From: Pierre Weis Message-Id: <200208051305.PAA22009@pauillac.inria.fr> Subject: Re: [Caml-list] Matching when In-Reply-To: <000f01c23c62$3ec98150$0700a8c0@warp> from Nicolas Cannasse at "Aug 5, 102 11:26:57 am" To: warplayer@free.fr (Nicolas Cannasse) Date: Mon, 5 Aug 2002 15:05:54 +0200 (MET DST) Cc: caml-list@inria.fr X-Mailer: ELM [version 2.4ME+ PL28 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi ! > I was thinking that the following should be possible : > > match e with > | Any > | Int x when x > 0 -> > .... (* here we don't use x *) > | .... > > But the typechecker reject it because of the unbound 'x' in the "Any" > matching. > I don't know what kind of difficulty this modification require, but it would > be nice if the compiler was able to resolve such cases. I would require to analyze the set of free variables of expression parts of match clauses to restrict the checks on variables of patterns to this set of variables. In this case, the set of (typed) variables of all the patterns of an ``or'' pattern should have the same intersection with the set of free variables of the corresponding expression of the clause, and this would solve your problem in a simple and elegant way. This is simple and does not involve any modification of the semantics of the language or of the pattern matching algorithm. Regards, Pierre Weis INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis/ ------------------- 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