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 SAA03680; Mon, 9 Apr 2001 18:07:18 +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 SAA03675 for ; Mon, 9 Apr 2001 18:07:17 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f39G7GP24590; Mon, 9 Apr 2001 18:07:16 +0200 (MET DST) Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id SAA03671; Mon, 9 Apr 2001 18:07:16 +0200 (MET DST) From: Pierre Weis Message-Id: <200104091607.SAA03671@pauillac.inria.fr> Subject: Re: [Caml-list] variant with tuple arg in pattern match? In-Reply-To: from Alain Frisch at "Apr 9, 101 02:22:54 am" To: frisch@clipper.ens.fr (Alain Frisch) Date: Mon, 9 Apr 2001 18:07:16 +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 > On Sun, 8 Apr 2001, Pierre Weis wrote: > > I suggest to explicitely annotate the constructor definitions as in: > > > > type t = > > | C : int -> int -> t > > This notation is explicit, intuitive, and allows refined type checking > > in some cases (for instance > > type 'a t = C : int -> bool -> (int * bool) t). > > How does this interact with pattern matching ? As usual. There would be no minteraction with the pattern matching facility of Objective Caml. [...] > For instance, with the declaration: > type 'a t = A : int t | B : 'a -> 'a t > do you issue a warning for: > function B x -> x > ? Yes, as usual: the constructor A is not covered by this matching. > -- > Alain Frisch One more, there is no interaction with the pattern matching algorithm, and as Daniel said, the syntax would just prevent you from trying to misuse the arguments of a constructor. Hope this helps, 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