caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Yaron Minsky <yminsky@janestreet.com>
To: Gabriel Scherer <gabriel.scherer@gmail.com>
Cc: Andreas Rossberg <rossberg@mpi-sws.org>,
	OCaML List Mailing <caml-list@inria.fr>
Subject: Re: [Caml-list] Equality between abstract type definitions
Date: Sun, 27 Oct 2013 10:43:20 -0400	[thread overview]
Message-ID: <CACLX4jREaMa6z7b6QK0hVRod_05Cvng6s5uB+NfJhTL-UYGxTg@mail.gmail.com> (raw)
In-Reply-To: <CAPFanBGo-_15V5NuppgCwE7kFsaKpbJyoTwdYv7RWf+t9m=L-w@mail.gmail.com>

But isn't this the exact opposite of Andreas' proposal?  He was
proposing using '_a as a unification variable, which may very well be
generalized.  It is exactly this use case for '_a that seems at odds
with Andreas' proposal.

y

On Sun, Oct 27, 2013 at 10:28 AM, Gabriel Scherer
<gabriel.scherer@gmail.com> wrote:
>> > Note how OCaml already uses '_a for a sort of flexible variable in its
>> > output.
>> Where?
>
> '_a is used for type variables that cannot be generalized.
>
> # let x = ref None;;
> val x : '_a option ref = {contents = None}
> # let id x = x in id id;;
> - : '_a -> '_a = <fun>
>
>
>
> On Sun, Oct 27, 2013 at 1:56 PM, Yaron Minsky <yminsky@janestreet.com>
> wrote:
>>
>> On Sun, Oct 27, 2013 at 8:16 AM, Andreas Rossberg <rossberg@mpi-sws.org>
>> wrote:
>> > On Oct 25, 2013, at 22:32 , Yaron Minsky <yminsky@janestreet.com> wrote:
>> >> Changing the semantics of this will, I think, break a _lot_ of code.
>> >
>> > Interesting. Do you have specific examples in mind?
>>
>> I know that I've seen many examples come up in my code.  One common
>> use is to partially specify a type.  For example, if I wanted to
>> ignore a return value that is a Tcp.Server.t from Async, I would
>> probably write it like this:
>>
>>     (ignore server : ('a,'b) Tcp.Server.t)
>>
>> without specifying the sometimes rather complicated details of those
>> types.  Similarly, if I were to ignore a Map, I might write
>>
>>     (ignore map : (int,string,'a) Map.t
>>
>> since it's not helpful here to specify the comparator type, which is
>> what goes into the third slot here.
>>
>> Nowadays, I would probably use an underscore in these cases rather
>> than an explicit type variable, but our codebase has plenty of old
>> examples of this kind of thing.  If a change like the one you propose
>> is changed, I presume that _ would keep its current meeting, which
>> would address many use cases.
>>
>> Given the existence of such use-cases, I would hope that we could
>> avoid making the change in a way that would non-optionally break lots
>> of code.  If people agree this change should be made, perhaps it
>> should be done in the mode of -strict-sequence.  That change was added
>> as a flag, so users could take it at their own pace.
>>
>> >> For what it's worth, I suspect that most people who are surprised by
>> >> this are people who were trained on Standard ML.  At Jane Street we've
>> >> had a lot of people learn the language, and the complaints I've heard
>> >> about this feature are, I think, mostly from that group.
>> >
>> > Maybe, but it's not my impression that this is true for most people I
>> > see asking related questions here on the list or on SO.
>>
>> To be clear, my guess above is less than scientific.
>>
>> >> I also don't find Andreas suggestion particularly intuitive.  I would
>> >> have guessed that (x: '_a) would constrain x to be a weakly
>> >> polymorphic value, which is at odds with the proposal.
>> >
>> > Now, _that_ is something I would only expect from programmers trained on
>> > SML -- ancient SML'90 to be precise. ;)
>> >
>> > Note how OCaml already uses '_a for a sort of flexible variable in its
>> > output.
>>
>> Where?
>>
>> > /Andreas
>> >
>>
>> --
>> Caml-list mailing list.  Subscription management and archives:
>> https://sympa.inria.fr/sympa/arc/caml-list
>> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
>> Bug reports: http://caml.inria.fr/bin/caml-bugs
>
>

  reply	other threads:[~2013-10-27 14:43 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 [this message]
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
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=CACLX4jREaMa6z7b6QK0hVRod_05Cvng6s5uB+NfJhTL-UYGxTg@mail.gmail.com \
    --to=yminsky@janestreet.com \
    --cc=caml-list@inria.fr \
    --cc=gabriel.scherer@gmail.com \
    --cc=rossberg@mpi-sws.org \
    /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).