caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Andreas Rossberg <rossberg@mpi-sws.org>
To: Didier.Remy@inria.fr
Cc: caml-list@inria.fr, Francois Pottier <Francois.Pottier@inria.fr>
Subject: Re: [Caml-list] Equality between abstract type definitions
Date: Sun, 27 Oct 2013 13:07:54 +0100	[thread overview]
Message-ID: <B14401A1-82A1-423D-92DD-9A91B4C5F2F5@mpi-sws.org> (raw)
In-Reply-To: <526BFCCA.8080804@inria.fr>

On Oct 26, 2013, at 19:32 , Didier Remy <Didier.Remy@inria.fr> wrote:
>>> When you annotate a program with types, you are just adding more
>>> type equations to the unification problem, and you may of
>>> course get at the end a type that is less generic than the one
>>> you gave in the annotation (that's the key rule of the game
>>> in unification).
> 
>> Aren't you conflating two different universes here? Namely, the
>> declarative type system and the type inference algorithm? The ML type
>> system semantics as such, at least in most formalisations I can remember,
>> knows nothing about unification variables -- that's an implementation
>> detail of algorithm W. And the user interface of a language is the
>> declarative system, not the underlying implementation. Making unification
>> variables user-visible is an extension to the basic ML type system that I
>> have rarely seen made precise
> 
> Andreas, I am not sure what point you are trying to make.
> 
> Sure, the name "unification variable" is misleading and should not be used
> here, as it refers to the algorithm. Instead, one should call them flexible
> type variable or whatever that refers to the specification.
> 
> Still, flexible variables make a lot of sense in the specification (even
> if not often done in formal presentations).

Oh, I agree. I was merely questioning that all explicit type variables in ML would naturally be flexible variables, which was what I was reading into Roberto's reply (if you take the preceding paragraph from his post as context). Sure, flexible variables are easy (and useful) to add, but technically speaking they are an extension, i.e., require extra rules. Or would you not say so?

And yes, I want to have both forms of variables/bindings, as I suggested in my original post. My main concern with the current state of affairs in OCaml is that implicitly interpreting 'a as the flexible kind obviously is surprising to many people, arguably because it is somewhat inconsistent. Especially when rigid probably is the more common use case.


> One can easily specify the introduction of a flexible variable 'a in some
> program M as the following typing rule and without reference to the
> implementation:
> 
>                          G |- M ['a <- t] : s
>                          -----------------------
>                          G |- for some 'a. M : s
> 
> François and I discuss this and formalize it in our chapter "The Essence of
> ML Type Inference" in "Advanced Topics in Types and Programming".

Ah, yes, thanks for the reminder.


>> (I seem to remember that the Didiers did that in the context of MLF).
> 
> Yes, since we needed more annotations in MLF because all function paramters
> that are used polymorphically must be annotated, we wanted to be able to
> only annoatte specify parts of the parameter that had to be used
> polymorphically.  We could give type annotations of the form:
> 
>        for some 'u, for all 'a, 'b, ('a -> 'b) -> 'a * 'u -> 'b * 'v
> 
> When used as the annotation of a function parameter, 'u could be freely
> instantiated, even to a polymorphic type, as long as this part of the
> argument was not used polymorphically.
> 
> We found this necessary in MLF, but it would also be quite useful in OCaml.


Yes, makes sense. I suppose the main obstacle is retrofitting a nice syntax into OCaml.

/Andreas


  reply	other threads:[~2013-10-27 12:07 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-24 22:57 Peter Frey
2013-10-24 23:23 ` Jacques Garrigue
2013-10-25  6:44   ` Andreas Rossberg
2013-10-25  8:29     ` Roberto Di Cosmo
2013-10-25  9:59       ` Ivan Gotovchits
2013-10-25 11:09         ` Gabriel Scherer
2013-10-25 14:24           ` Andreas Rossberg
2013-10-25 20:32             ` Yaron Minsky
2013-10-25 20:44               ` Jacques Le Normand
2013-10-26  1:08                 ` Norman Hardy
2013-10-26  5:28                   ` Jacques Garrigue
2013-10-27 12:16               ` Andreas Rossberg
2013-10-27 12:56                 ` Yaron Minsky
2013-10-27 14:28                   ` Gabriel Scherer
2013-10-27 14:43                     ` Yaron Minsky
2013-10-27 15:25                       ` Gabriel Scherer
2013-10-27 15:41                         ` Yaron Minsky
2013-10-25 12:35         ` Roberto Di Cosmo
2013-10-25 12:45           ` Jonathan Protzenko
2013-10-25 13:20             ` Roberto Di Cosmo
2013-10-25 14:03       ` Andreas Rossberg
2013-10-26  9:07         ` oleg
2013-10-26 14:11           ` Didier Remy
2013-10-26 17:32         ` Didier Remy
2013-10-27 12:07           ` Andreas Rossberg [this message]
2013-10-27 14:10             ` Roberto Di Cosmo
2013-10-28  3:30     ` Jacques Garrigue

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=B14401A1-82A1-423D-92DD-9A91B4C5F2F5@mpi-sws.org \
    --to=rossberg@mpi-sws.org \
    --cc=Didier.Remy@inria.fr \
    --cc=Francois.Pottier@inria.fr \
    --cc=caml-list@inria.fr \
    /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).