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 081357FD3B for ; Sat, 21 Nov 2015 18:42:35 +0100 (CET) IronPort-PHdr: 9a23:pMn7oBB2OWpgDzjzxFcXUyQJP3N1i/DPJgcQr6AfoPdwSP/7osbcNUDSrc9gkEXOFd2CrakU1qyI7Ou/ByQp2tWojjMrSNR0TRgLiMEbzUQLIfWuLgnFFsPsdDEwB89YVVVorDmROElRH9viNRWJ+iXhpQAbFhi3DwdpPOO9QteU1JTqkb7tsMKNKyxzxxODIppKZC2sqgvQssREyaBDEY0WjiXzn31TZu5NznlpL1/A1zz158O34YIxu38I46Fp34d6XK77Z6U1S6BDRHRjajhtpZ7djgTYVQaE+lcbV2wXlFIIX1mEv1nGWcLRvy32rOt+kAOdOsi+GbA5Xzi47qRDVBjwjyZBLzk+6Sfcjckm34xBpxf0iBV12Y/ZZMmuP/pzZK7HNYcVTGBbX8tVETdKAo6mYpEnAO8IPOIepI748Qhd5SCiDBWhUbu8ggRDgWX7iOhniuk= Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=gabriel.scherer@gmail.com; spf=Pass smtp.mailfrom=gabriel.scherer@gmail.com; spf=None smtp.helo=postmaster@mail-io0-f169.google.com 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.223.169; 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.223.169 as permitted sender) identity=mailfrom; client-ip=209.85.223.169; 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-io0-f169.google.com) identity=helo; client-ip=209.85.223.169; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="postmaster@mail-io0-f169.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0DmAACgq1BWm6nfVdFehA5vBq8shTiMGhcBCYVuAoEoBzwQAQEBAQEBAQEQAQEBAQEGCwsJIS6CLYIHAQEBAgEBEhEEGQEbEgsBAwELBgULDQ0dAgIiAREBBQEKEgYTCQkHCYd2AQMKCA2hcIExPjGLSIFqgnmFTQoZJwMKVoQZAQEBAQEFAQEBAQEBAQEVAQUOhkaEfoUIgjM6E4ExBYYODJA2hSSIDYIkmFoSJIEXESeCLyOBXj00AYUqAQEB X-IPAS-Result: A0DmAACgq1BWm6nfVdFehA5vBq8shTiMGhcBCYVuAoEoBzwQAQEBAQEBAQEQAQEBAQEGCwsJIS6CLYIHAQEBAgEBEhEEGQEbEgsBAwELBgULDQ0dAgIiAREBBQEKEgYTCQkHCYd2AQMKCA2hcIExPjGLSIFqgnmFTQoZJwMKVoQZAQEBAQEFAQEBAQEBAQEVAQUOhkaEfoUIgjM6E4ExBYYODJA2hSSIDYIkmFoSJIEXESeCLyOBXj00AYUqAQEB X-IronPort-AV: E=Sophos;i="5.20,328,1444687200"; d="scan'208";a="154660236" Received: from mail-io0-f169.google.com ([209.85.223.169]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 21 Nov 2015 18:42:33 +0100 Received: by ioc74 with SMTP id 74so152672984ioc.2 for ; Sat, 21 Nov 2015 09:42:32 -0800 (PST) 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=ZapwlrRQTIvv8rFWc3vgB8DLANhtIaoxTII35PCbeOE=; b=YOvhm1lbWYQBOiBEuxA6uKegEIQKvhizSGkENng/kc+2qaX88g5WArRXwZiRMqeGAA 45gCjEdMJGZ1jsmbMsk3O1bZdZsrbBGfafTf8JA508L83+BcFiunlKsoYxWZcghncu3U ZaqSY27R/VJaUIphG4aUM6pMTFV6bQZkg6y3RZHBV987P+P8UcJVHlYERN3Ifb7HB/Hw I+pz45OHt4J1KThkvAi879hFNSj+pndqvSMwuES2n45Pj1oyp/6rxNkpkHMXZmu3sA5o S3rzqRrpRl4rp9QkX2XMqSJiI+g4MoI1eak4643puvgZR7Tr/hp9srqrIN8MKDf4ZVDj F8Mg== X-Received: by 10.107.170.19 with SMTP id t19mr19630778ioe.70.1448127752328; Sat, 21 Nov 2015 09:42:32 -0800 (PST) MIME-Version: 1.0 Received: by 10.79.39.200 with HTTP; Sat, 21 Nov 2015 09:41:53 -0800 (PST) In-Reply-To: <20151121172401.GA31756@topoi.pooq.com> References: <0F7D3B1B3C4B894D824F5B822E3E5A172CE3E070@IRSMSX102.ger.corp.intel.com> <563C816B.7020604@inria.fr> <0F7D3B1B3C4B894D824F5B822E3E5A172CE3E0E1@IRSMSX102.ger.corp.intel.com> <20151121172401.GA31756@topoi.pooq.com> From: Gabriel Scherer Date: Sat, 21 Nov 2015 18:41:53 +0100 Message-ID: To: Hendrik Boom Cc: caml users Content-Type: multipart/alternative; boundary=001a11425bd2445e60052510843d Subject: Re: [Caml-list] Notation for currying --001a11425bd2445e60052510843d Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable In a previous life I would write Camlp4 extension for fun, and I used the syntax \( ... _ ...) to abstract over an anonymous variables (you could also use \1 \2 \3 etc, and the n-th occurence of _ from left to right was turned into \n, but mixing numbers and _ was disallowed). It solves Scala's problem that, the scope of _ being delimited by the closest parentheses, the notation was not composable -- but arguably enforcing a small scope is a good thing. This is the kind of features that nobody will ever agree on, so it's too hard to get them in a language. Nowadays I write "(fun x ->" instead of "\(", and "x" instead of "_", and it is not that bad. Arthur Chargu=C3=A9raud has been working on an "easy-type-errors" mode with better typing error messages for OCaml. You may be interested in his article http://www.chargueraud.org/research/2015/ocaml_errors/ocaml_errors.pdf although I think this specific case of under-application is not discussed (using too many argument is discussed). I also find the work on SHErrLoc, by Danfeng Zhang, Andrew C. Myers and their collaborators, to be very impressive: http://www.cs.cornell.edu/Projects/SHErrLoc/ On Sat, Nov 21, 2015 at 6:24 PM, Hendrik Boom wrote: > On Fri, Nov 06, 2015 at 01:34:11PM +0100, Gabriel Scherer wrote: > > > > I personally believe that currified constructor syntax would be a better > > choice, and that using non-currified constructors is a historical mista= ke > > of SML/Caml. But I am also not convinced that efforts to change it today > > are worth the trouble, and prefer to concentrate on improving other par= ts > > of the OCaml ecosystem. > > Perhaps there should be explicit syntax for currying, such as > f a b _ > instead of > f a b > That would permit currying in other argument positions: > f a _ c > though I suspect _ may be the wrong symbol for the current language, and > I also suspect it's far too late tointroduce it in the current language. > > I have noticed that almost a the situations where the compiler thinks I > mean to curry I actually just left out a parameter by mistake. The type > inferences it makes based on these errors usually occur elsewhere and > are truly mystifying. > > -- hendrik > > -- > 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 > --001a11425bd2445e60052510843d Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
In a previous life I would write = Camlp4 extension for fun, and I used the syntax
=C2=A0 \( ... _ ...)
=
to abstract over an anonymous variables (you could also use \1 \2 \3 = etc, and the n-th occurence of _ from left to right was turned into \n, but= mixing numbers and _ was disallowed). It solves Scala's problem that, = the scope of _ being delimited by the closest parentheses, the notation was= not composable -- but arguably enforcing a small scope is a good thing.
This is the kind of features that nobody will ever agree on, so = it's too hard to get them in a language. Nowadays I write "(fun x = ->" instead of "\(", and "x" instead of "_= ", and it is not that bad.

Arthur Chargu=C3=A9raud has be= en working on an "easy-type-errors" mode with better typing error= messages for OCaml. You may be interested in his article
=C2=A0 http://www.chargueraud.org/research/2015/ocaml_errors/ocaml_errors.pdf=
although I think this specific case of under-application is not d= iscussed (using too many argument is discussed).

I also find t= he work on SHErrLoc, by Danfeng Zhang, Andrew C. Myers and their collaborat= ors, to be very impressive:
=C2=A0 http://www.cs.cornell.edu/Projects/SHErrLoc/

On Sat, Nov 21= , 2015 at 6:24 PM, Hendrik Boom <hendrik@topoi.pooq.com> wrote:
On Fri, Nov 06, 2015 at 01:34:11= PM +0100, Gabriel Scherer wrote:
>
> I personally believe that currified constructor syntax would be a bett= er
> choice, and that using non-currified constructors is a historical mist= ake
> of SML/Caml. But I am also not convinced that efforts to change it tod= ay
> are worth the trouble, and prefer to concentrate on improving other pa= rts
> of the OCaml ecosystem.

Perhaps there should be explicit syntax for currying, such as
=C2=A0 =C2=A0f a b _
instead of
=C2=A0 =C2=A0f a b
That would permit currying in other argument positions:
=C2=A0 =C2=A0f a _ c
though I suspect _ may be the wrong symbol for the current language, and
I also suspect it's far too late tointroduce it in the current language= .

I have noticed that almost a the situations where the compiler thinks I
mean to curry I actually just left out a parameter by mistake.=C2=A0 The ty= pe
inferences it makes based on these errors usually occur elsewhere and
are truly mystifying.

-- hendrik

--
Caml-list mailing list.=C2=A0 Subscription management and archives:
https://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocam= l_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

--001a11425bd2445e60052510843d--