caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
To: n8gray@gmail.com
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Labels and polymorphism
Date: Tue, 20 Mar 2007 09:51:12 +0900 (JST)	[thread overview]
Message-ID: <20070320.095112.93380374.garrigue@math.nagoya-u.ac.jp> (raw)
In-Reply-To: <aee06c9e0703191653p6e8a32f0i7a2e753ebff3f02c@mail.gmail.com>

From: "Nathaniel Gray" <n8gray@gmail.com>

> > 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


  reply	other threads:[~2007-03-20  0:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-08 18:31 Nathaniel Gray
2007-03-08 19:14 ` [Caml-list] " Eric Cooper
2007-03-08 19:40 ` Roland Zumkeller
2007-03-08 23:42   ` Nathaniel Gray
2007-03-19  1:15     ` Jacques Garrigue
2007-03-19 23:53       ` Nathaniel Gray
2007-03-20  0:51         ` Jacques Garrigue [this message]
2007-03-08 23:30 ` skaller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070320.095112.93380374.garrigue@math.nagoya-u.ac.jp \
    --to=garrigue@math.nagoya-u.ac.jp \
    --cc=caml-list@inria.fr \
    --cc=n8gray@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).