caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Andreas Rossberg <rossberg@mpi-sws.org>
To: Leo White <lpw25@cam.ac.uk>
Cc: David Sheets <sheets@alum.mit.edu>, Caml List <caml-list@inria.fr>
Subject: Re: [Caml-list] First-class Functor Forgetting for Free
Date: Mon, 12 Aug 2013 14:15:43 +0200	[thread overview]
Message-ID: <5208D1EF.5050302@mpi-sws.org> (raw)
In-Reply-To: <86haevnnr5.fsf@cam.ac.uk>

On 08/12/2013 01:37 PM, Leo White wrote:
>>> So,
>>>
>>>     let g x = let module X = (val x : D) in X.(f x)
>>>
>>> would have a type:
>>>
>>>     (module D with ..) -> int
>>
>> This certainly is a nice suggestive syntax, but it is assuming an underlying semantic similarity that does not
>> exist. Semantically, the type sharing equations on signatures have very little in common with rows, and I have a hard
>> time imagining what interpreting the above as a row would even mean or how it would fit in with either core or module
>> typing.
>
> I don't see what is hard to imagine. The row variable represents
> possible extra with-constraints. The type above can be unified with any
> package type with signature D.
>
> With-constraints are essentially sets of label and type pairs, row
> polymorphism provides a mechanism for typing sets of label and type
> pairs. I don't see where they differ "semantically".

With constraints generally map _type paths_ to _type constructors_. 
Moreover, the domain of type paths is bounded by what actually occurs in 
the signature. That already sets them apart from rows on a basic 
syntactic and semantic level. (Mind you, OCaml doesn't currently allow 
revealing type constructors in package types, but that is a limitation 
that seems much more important to lift than what we are discussing here.)

More importantly, unlike for rows, not listing a type in a constraint 
doesn't mean that it's absent. It means that it is kept abstract. That's 
quite different, and it would require some notion of implicit 
existential type introduction based on the instantiation, for which I 
have no idea how it should work. Some form of skolemisation perhaps? How 
does that integrate with the rest of core typing and inference? Type 
inference with existentials is known to be very tricky.

I also wouldn't know how exactly the row idea ties in with signature 
matching. What does (S with ..) < S mean? The only interpretation I can 
see is by expanding ".." into a list of equations for all types abstract 
in S -- but that would notably _not_ be a row-polymorphic interpretation.

Hope those are enough open questions for now. :)

/Andreas


  reply	other threads:[~2013-08-12 12:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-11  1:55 David Sheets
2013-08-11  7:53 ` Andreas Rossberg
2013-08-11 13:29   ` David Sheets
2013-08-11 14:32     ` Andreas Rossberg
2013-08-11 14:58       ` Leo White
2013-08-12 11:01         ` Andreas Rossberg
2013-08-12 11:37           ` Leo White
2013-08-12 12:15             ` Andreas Rossberg [this message]
2013-08-12 13:06               ` Leo White
2013-08-12 14:15                 ` Andreas Rossberg
2013-08-12 15:17                   ` Leo White
2013-08-12 16:08                     ` Andreas Rossberg
2013-08-12 16:46                       ` Leo White
2013-08-13 11:22                         ` Andreas Rossberg

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=5208D1EF.5050302@mpi-sws.org \
    --to=rossberg@mpi-sws.org \
    --cc=caml-list@inria.fr \
    --cc=lpw25@cam.ac.uk \
    --cc=sheets@alum.mit.edu \
    /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).