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 VAA18332; Wed, 4 Apr 2001 21:49:20 +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 VAA18429 for ; Wed, 4 Apr 2001 21:49:19 +0200 (MET DST) Received: from verdot.inria.fr (verdot.inria.fr [128.93.11.7]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f34JnIr29252 for ; Wed, 4 Apr 2001 21:49:18 +0200 (MET DST) Received: (from ddr@localhost) by verdot.inria.fr (8.9.3/8.9.3) id VAA01458 for caml-list@inria.fr; Wed, 4 Apr 2001 21:49:18 +0200 Date: Wed, 4 Apr 2001 21:49:18 +0200 From: Daniel de Rauglaudre To: caml-list@inria.fr Subject: Re: [Caml-list] variant with tuple arg in pattern match? Message-ID: <20010404214918.V24841@verdot.inria.fr> References: <4.3.2.7.2.20010404034802.0334fae0@shell16.ba.best.com> <4.3.2.7.2.20010404123148.03366c90@shell16.ba.best.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0us In-Reply-To: <4.3.2.7.2.20010404123148.03366c90@shell16.ba.best.com>; from checker@d6.com on Wed, Apr 04, 2001 at 12:36:58PM -0700 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi, My opinion is that the confusion comes from the syntax. In my revised syntax by Camlp4, I propose to represent constructors with several parameters with currification syntax. You can write: type t1 = [ Foo of int and int ] to specify two parameters type t2 = [ Bar of (int * int) ] to specify one parameter, a tuple And you (must) write: Foo 3 5 Bar (3, 5) The case: Foo 3 answers: The constructor Foo expects 2 argument(s), but is here applied to 1 argument(s) which is normal. Idem for the case: match x with [ Foo y -> y ] To get the couple, you have to write: match x with [ Foo y z -> (y, z) ] This is logical. With this syntax, no possible confusion. You would even not have asked the question. It is not a question of semantics, but a question of *syntax*. -- Daniel de RAUGLAUDRE daniel.de_rauglaudre@inria.fr http://cristal.inria.fr/~ddr/ ------------------- To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr