From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 2C3E77EE25 for ; Sun, 27 Oct 2013 15:28:49 +0100 (CET) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of gabriel.scherer@gmail.com) identity=pra; client-ip=209.85.214.44; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of gabriel.scherer@gmail.com designates 209.85.214.44 as permitted sender) identity=mailfrom; client-ip=209.85.214.44; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-bk0-f44.google.com) identity=helo; client-ip=209.85.214.44; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="postmaster@mail-bk0-f44.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ak8CAIgibVLRVdYsnGdsb2JhbABZgz9UrACKGIhHgRQIFg4BAQEBAQYNCQkUKIIlAQEEAScZARsSCwEDAQsGBQsDCg0hIgERAQUBChIGExKHYgEDCQYNmUOMVoMKg3UKGScDCmSJAQEFDI9FBAeELAOYCoEvjmwYKYRSOw X-IPAS-Result: Ak8CAIgibVLRVdYsnGdsb2JhbABZgz9UrACKGIhHgRQIFg4BAQEBAQYNCQkUKIIlAQEEAScZARsSCwEDAQsGBQsDCg0hIgERAQUBChIGExKHYgEDCQYNmUOMVoMKg3UKGScDCmSJAQEFDI9FBAeELAOYCoEvjmwYKYRSOw X-IronPort-AV: E=Sophos;i="4.93,580,1378850400"; d="scan'208";a="32083417" Received: from mail-bk0-f44.google.com ([209.85.214.44]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 27 Oct 2013 15:28:48 +0100 Received: by mail-bk0-f44.google.com with SMTP id mz10so1435160bkb.3 for ; Sun, 27 Oct 2013 07:28:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=tpHDmNI/DTwPBQV8KTq9wQnR24uVxkc5hlD2RAIMQT0=; b=dd0Lh5lM7TfwFS53PvPfOAUq2eaYReR0vYUuChT7+p8OEWfNsbvSnI6crABwMyayLq NXKE7dNB31NzFaZXw/pQC4tdpx6yt7l2r9zB7s1CdKv4l3W+e3xFkl1+lCAPHAwcl2Wg syVEDNqe3tJIaeiK8QSzbBRy8aMV4lt6xomNCrfsR6in+iqHTADhNO0+2vSeXpzzontm Ay/CZTFANaQ4wMryOn3ee31KrRGJQBfije3aaTk92apayE0byMaMMJP0upSd2W8EyAuQ Kb0Gjtdb8DiU9mBX2VrZVgB1McaWNqmKFwyRcCsgcNwxgmLGPlzXiSgHS5MIeej+2x+b chHQ== X-Received: by 10.205.76.133 with SMTP id ze5mr133634bkb.37.1382884127567; Sun, 27 Oct 2013 07:28:47 -0700 (PDT) MIME-Version: 1.0 Received: by 10.204.122.72 with HTTP; Sun, 27 Oct 2013 07:28:07 -0700 (PDT) In-Reply-To: References: <97627FCD-30E1-45AD-A72B-CD423170C0AC@math.nagoya-u.ac.jp> <20131025082911.GB23798@voyager> <878uxhd62p.fsf@golf.niidar.ru> <526A7F33.6040203@mpi-sws.org> <66AB5484-8BFC-4A1C-ADAC-99C75716B054@mpi-sws.org> From: Gabriel Scherer Date: Sun, 27 Oct 2013 15:28:07 +0100 Message-ID: To: Yaron Minsky Cc: Andreas Rossberg , OCaML List Mailing Content-Type: multipart/alternative; boundary=f46d041555ec30a1ec04e9b9cdb9 Subject: Re: [Caml-list] Equality between abstract type definitions --f46d041555ec30a1ec04e9b9cdb9 Content-Type: text/plain; charset=ISO-8859-1 > > 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 = On Sun, Oct 27, 2013 at 1:56 PM, Yaron Minsky wrote: > On Sun, Oct 27, 2013 at 8:16 AM, Andreas Rossberg > wrote: > > On Oct 25, 2013, at 22:32 , Yaron Minsky 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 > --f46d041555ec30a1ec04e9b9cdb9 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
> > Note how OCaml already uses '_a for a s= ort of flexible variable in its output.
> Where?

'_a= is used for type variables that cannot be generalized.

# let x =3D = ref None;;
val x : '_a option ref =3D {contents =3D None}
# let id x =3D x in i= d id;;
- : '_a -> '_a =3D <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 <rossber= g@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 cod= e.
>
> Interesting. Do you have specific examples in mind?

I know that I've seen many examples come up in my code. =A0One co= mmon
use is to partially specify a type. =A0For example, if I wanted to
ignore a return value that is a Tcp.Server.t from Async, I would
probably write it like this:

=A0 =A0 (ignore server : ('a,'b) Tcp.Server.t)

without specifying the sometimes rather complicated details of those
types. =A0Similarly, if I were to ignore a Map, I might write

=A0 =A0 (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. =A0If 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. =A0If people agree this change should be made, perhaps it
should be done in the mode of -strict-sequence. =A0That 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 surpri= sed by
>> this are people who were trained on Standard ML. =A0At Jane Street= we've
>> had a lot of people learn the language, and the complaints I'v= e heard
>> about this feature are, I think, mostly from that group.
>
> Maybe, but it's not my impression that this is true for most peopl= e 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. = =A0I 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. =A0Subscription management and archives:
ht= tps://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

--f46d041555ec30a1ec04e9b9cdb9--