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 nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 63D03BB81 for ; Fri, 24 Feb 2006 03:17:42 +0100 (CET) Received: from kurims.kurims.kyoto-u.ac.jp (kurims.kurims.kyoto-u.ac.jp [130.54.16.1]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id k1O2HevW013408 for ; Fri, 24 Feb 2006 03:17:41 +0100 Received: from localhost (mikan [130.54.16.202]) by kurims.kurims.kyoto-u.ac.jp (8.13.1/8.13.1) with ESMTP id k1O2HaTZ013751; Fri, 24 Feb 2006 11:17:37 +0900 (JST) Date: Fri, 24 Feb 2006 11:17:28 +0900 (JST) Message-Id: <20060224.111728.88698334.garrigue@math.nagoya-u.ac.jp> To: lukstafi@gmail.com Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] (int * int) <> int*int ? From: Jacques Garrigue In-Reply-To: <4a708d20602231618r4839fe7wa695e9084df8fd40@mail.gmail.com> References: <00c201c638b1$b2b96860$1f570b50@mshome.net> <20060224.090116.89069794.garrigue@math.nagoya-u.ac.jp> <4a708d20602231618r4839fe7wa695e9084df8fd40@mail.gmail.com> X-Mailer: Mew version 4.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 43FE6CC4.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 lukasz:01 syntax:01 variants:01 syntax:01 constructors:01 datatypes:01 variants:01 constructors:01 polymorphic:01 polymorphic:01 constructor:01 argument:01 argument:01 int: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.4 required=5.0 tests=DNS_FROM_RFC_ABUSE autolearn=disabled version=3.0.3 From: "Lukasz Stafiniak" > > This unfortunate syntax has consequences down to polymorphic variants, > > which otherwise could be represented more efficiently. > > > This is interesting, could you explain it shortly? 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. For datatypes, the ambiguity is solved by looking-up the definition. With polymorphic variants, there is no definition, so one is forced to use a uniform representation, namely all constructors have either 0 or 1 argument. This means that `A(arg1,arg2) has to be represented internally as [|`A; [|arg1; arg2|] |]. With a non-ambiguous syntax, like (`A arg1 arg2), it would be possible to use a more compact internal representation: [|`A; arg1; arg2|]. This is not a big problem, just an historical hiccup. Jacques