From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 576CBBB81 for ; Fri, 24 Feb 2006 14:08:03 +0100 (CET) Received: from [128.93.11.101] (buzet.inria.fr [128.93.11.101]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id k1OD82tp007313 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 24 Feb 2006 14:08:03 +0100 Message-ID: <43FF04F8.7050000@inria.fr> Date: Fri, 24 Feb 2006 14:07:04 +0100 From: Alain Frisch User-Agent: Debian Thunderbird 1.0.7 (X11/20051017) X-Accept-Language: en-us, en MIME-Version: 1.0 To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] (int * int) <> int*int ? References: <00c201c638b1$b2b96860$1f570b50@mshome.net> <20060224.090116.89069794.garrigue@math.nagoya-u.ac.jp> <4a708d20602231618r4839fe7wa695e9084df8fd40@mail.gmail.com> <20060224.111728.88698334.garrigue@math.nagoya-u.ac.jp> In-Reply-To: <20060224.111728.88698334.garrigue@math.nagoya-u.ac.jp> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 43FF0532.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; frisch:01 frisch:01 caml-list:01 syntax:01 constructors:01 statically:01 variants:01 syntactical:01 runtime:01 non-zero:01 wrote:01 dynamically:01 constructor:01 constructor:01 functions:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 Jacques Garrigue wrote: > The tuple based syntax for constructors is ambiguous: there is no way > to know syntactically whether a constructor takes as argument a tuple > or separate arguments. This is the reason for this whole discussion. In a sense, the same applies to functions. When a function is called, there is no way to know statically whether it expects more arguments (the call creates a closure) or not (the body of the function can be evaluated now). As you know, this is solved dynamically. One could imagine the same for variants. Applying a constructor with several syntactical arguments `A(arg1,arg2) would create a block [| `A; arg1; arg2 |] whereas "let x = (arg1,arg2) in `A x" would create a block [| `A; [| arg1; arg2 |] |]. Then it is up to pattern matching to be more clever and deal with the two possible cases at runtime (maybe one wants to use a non-zero tag for the block [| `A; arg1; arg2 |]), possibly creating new tuples as in "match `A(arg1,arg2) with `A x -> x". I'm not claiming that it is worth the extra complexity nor that it would really improve anything, though... -- Alain