caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
To: Jordo <jordojw@gmail.com>
Cc: David Allsopp <dra-news@metastack.com>,
	OCaml Mailing List <caml-list@inria.fr>
Subject: Re: [Caml-list] Explicit Arity with Polymorphic Variants
Date: Mon, 26 Jan 2015 13:05:44 +0900	[thread overview]
Message-ID: <E68C20B6-87BF-466B-93EB-FA414D83F6C9@math.nagoya-u.ac.jp> (raw)
In-Reply-To: <02B4AAD3-9AD1-42F8-BDCA-FFAA7EA43F03@gmail.com>

On 2015/01/26 04:57, Jordo wrote:
> 
> You've listed some good examples of why this would be difficult to implement and some examples of how this would be confusing to developers. But I am having a hard time seeing how you have demonstrated why polymorphic variants cannot assume two forms - each incompatible with the other, with any particular form being completely inferred. I am not claiming that a distinction between the two forms is not needed at the type level - the two forms would be incompatible with each other at the type level just as they are incompatible for standard variants. My question was why does a distinction at the type level require a type *definition* (which was your original claim). For the sake of experimentation, assume you can create any syntax you need that would unambiguously express which of the two forms is being reasoned about in all situations.


Indeed, there is no theoretical difficulty in introducing multi-argument polymorphic variants, and they were considered at some point.
However, for this to work this should imperatively be supported at the type level too: multi-argument polymorphic variant should have a type incompatible with single-argument ones.
So this means making the type algebra more complex, adding extra syntax both at the value/pattern and type level, and extending the unification and type inference algorithms, for something that doesn't seem that useful (if you need performance, you're better served by normal variants anyway).
Of course you're free to try to add them to the compiler :-)

	Jacques

  reply	other threads:[~2015-01-26  4:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-23  6:53 Jordan W
2015-01-23  8:03 ` Jacques Garrigue
2015-01-23  9:04   ` Jordan W
2015-01-23  9:56     ` David Allsopp
2015-01-24  8:52     ` Gabriel Scherer
2015-01-25  8:02       ` Jordan W
2015-01-25 10:11         ` David Allsopp
2015-01-25 19:57           ` Jordo
2015-01-26  4:05             ` Jacques Garrigue [this message]
2015-01-24  3:47   ` Jordan W
2015-01-24  8:24     ` David Allsopp

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=E68C20B6-87BF-466B-93EB-FA414D83F6C9@math.nagoya-u.ac.jp \
    --to=garrigue@math.nagoya-u.ac.jp \
    --cc=caml-list@inria.fr \
    --cc=dra-news@metastack.com \
    --cc=jordojw@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).