From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.4 required=5.0 tests=AWL,DNS_FROM_RFC_ABUSE autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id B2263BC69 for ; Tue, 20 Mar 2007 01:51:20 +0100 (CET) Received: from kurims.kurims.kyoto-u.ac.jp (kurims.kurims.kyoto-u.ac.jp [130.54.16.1]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l2K0pINe025181 for ; Tue, 20 Mar 2007 01:51:19 +0100 Received: from localhost (orion [130.54.16.5]) by kurims.kurims.kyoto-u.ac.jp (8.13.7/8.13.7) with ESMTP id l2K0pGkg028356; Tue, 20 Mar 2007 09:51:16 +0900 (JST) Date: Tue, 20 Mar 2007 09:51:12 +0900 (JST) Message-Id: <20070320.095112.93380374.garrigue@math.nagoya-u.ac.jp> To: n8gray@gmail.com Cc: caml-list@inria.fr Subject: Re: [Caml-list] Labels and polymorphism From: Jacques Garrigue In-Reply-To: References: <20070319.101500.03115026.garrigue@math.nagoya-u.ac.jp> 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 discorde with ID 45FF3006.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; polymorphism:01 subtyping:01 subtype:01 subtyping:01 inference:01 coercions:01 caml-list:01 functions:01 argument:02 partially:02 match:02 parameters:02 objects:02 garrigue:03 garrigue:03 From: "Nathaniel Gray" > > The second problem is more fundamental: adding labels to a function > > cannot be done without breaking compatibility. This is because > > labels must match exactly when you pass a function as argument to > > another function. > > I'm not sure I accept this. What I would like is a subtyping relation > between labeled and unlabeled functions. A function with labels is a > subtype of the label-erased (or partially label-erased) version of > that function. Is there some reason this is not possible? Just that subtyping doesn't play well with type inference. This is why subtyping for objects is completely explicit. As a result, while your subtyping-based approach seems sound, it would still not allow transparent addition of labels, as one would have to add coercions to "remove" labels from function types. Note also that your subtyping approach is weaker than your earlier proposal: out-of-order application is only allowed when all formal parameters are labeled. And this doesn't take optional arguments into account. This said, this could be a nice proposal for labeled arguments in Java, for instance. Jacques Garrigue