caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Sven SAULEAU <sven.sauleau@xtuc.fr>
To: <caml-list@inria.fr>
Subject: Re: [Caml-list] ReasonML concrete syntax
Date: Mon, 11 Dec 2017 07:50:02 +0100	[thread overview]
Message-ID: <e395579f-bd3f-124e-5aa3-2c7c430c7411@xtuc.fr> (raw)
In-Reply-To: <CAG_8+G5t_iL9JYq8cCpSg_n9GtM4+5cW3x9y02eL6Y4jNfkfLw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3065 bytes --]

Hi,

The reason behind that move (from Reasonml version 2 to 3), is that it feels more natural to JavaScript developers.

Since it's quite a new language and their main target are JS developers this kinda make sense to me but I agree with Viet, as a ML fan I don't like this new syntax.

Also I hope it won't confuse them about functional programming concepts. Partial application for example looks not clear at all that way:

let add = (x, y) => x + y;
let addFive = add(5);
let eleven = addFive(6);
let twelve = addFive(7);

In JavaScript add* functions clearly only take one argument.

has very well received in the JavaScript community and it will lead to wider OCaml adoption

I'm afraid it probably won't, if they are used to the JavaScript syntax. Reasonml is also meant to be used in the web more than used through OCaml.

Sven.

On 11/12/2017 06:50, Viet Le wrote:
Such a terrible way to cave in to appear more JS-esque. I really hope OCaml community doesn't adopt this style because it's confusing, inelegant and superficial.

Viet.

On Mon, 11 Dec 2017 at 00:11, Yawar Amin <yawar.amin@gmail.com<mailto:yawar.amin@gmail.com>> wrote:
Hi Bob, you can find more details about the syntax change and discussion in this slightly outdated PR: https://github.com/facebook/reason/pull/1299

Long story short, you can write let add((m, n)) = m + n.

Note that the ReasonML project actually includes several long-time members of the OCaml community. I feel that the new syntax has very well received in the JavaScript community and it will lead to wider OCaml adoption. It's a win-win situation.

Regards,

Yawar

On Sun, Dec 10, 2017 at 1:12 PM, Robert Muller <robert.muller2@gmail.com<mailto:robert.muller2@gmail.com>> wrote:
The team developing ReasonML seems to be experimenting with concrete syntax in an effort to make it feel as familiar and natural as possible to JavaScript programmers. Seems like a good idea. But the present version seems to hardwire parentheses awkwardly for function definitions and calls. Parentheses are required for both function definitions and calls. So one writes

let incr(n) = n + 1       and   incr(5)

but not

let incr n = n + 1        or    incr 5

Fair enough, but for multi-argument functions the parser seems to unroll the parenthesized items (both parameters & arguments) to leave curried functions. E.g.,

let add(m, n) = m + n  or equivalently let add = (m, n) => m + n

then add(5, 3) is 8 as one would expect. But the (m, n) in let add(m, n) = ... isn't a pattern matching a pair, it's the JS-style sequence of input parameters and the definition unrolls to let add = (m) => (n) => ... . So add(5) : int -> int and all three of add(5, 3), add(5)(3) and { let add5 = add(5);  add5(3) } are 8. There's probably a way to write an add function of type int * int -> int, but I don't know how to write it.

I'm wondering what the OCaml community makes of this. I find it awkward.
Bob Muller



--
Kind regards,
Viet


--

Sven SAULEAU

+33 6 28 69 51 44

[-- Attachment #2: Type: text/html, Size: 6469 bytes --]

  parent reply	other threads:[~2017-12-11  6:50 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-10 18:12 Robert Muller
2017-12-11  0:09 ` Yawar Amin
2017-12-11  5:50   ` Viet Le
2017-12-11  6:45     ` Ian Zimmerman
2017-12-11  6:53       ` Sven SAULEAU
2017-12-11  6:50     ` Sven SAULEAU [this message]
2017-12-11  6:54       ` Evgeny Khramtsov
2017-12-11  7:22         ` =?gb18030?B?Qm9i?=
2017-12-11  7:16           ` Evgeny Khramtsov
2017-12-17 15:02         ` Paolo Donadeo
2017-12-17 16:01           ` Guillaume Huysmans
2017-12-17 16:55             ` Paolo Donadeo
2017-12-17 20:13               ` Ian Zimmerman
2017-12-17 20:49                 ` Robert Muller
2017-12-18  1:34                   ` Yawar Amin
2017-12-18 16:36                     ` Evgeny Khramtsov
2017-12-18 17:00                       ` Jesper Louis Andersen
2017-12-18 17:27                         ` Gary Trakhman
2017-12-18 17:53                         ` Evgeny Khramtsov
2017-12-18  2:14                   ` Yawar Amin
2017-12-11 15:51       ` Yawar Amin
2017-12-11 16:07         ` Sven SAULEAU
2017-12-11 17:11         ` David Brown
2017-12-12  3:49         ` Louis Roché
2017-12-12  4:18           ` Yawar Amin
2017-12-12  5:52           ` Oliver Bandel
2017-12-11 14:40 ` Gerd Stolpmann
2017-12-11 16:10   ` Ian Zimmerman
2017-12-11 16:47     ` Viet Le
2017-12-11 17:10       ` Yotam Barnoy
2017-12-11 18:56         ` Robert Muller
2017-12-11 19:23           ` Yawar Amin
2017-12-11 21:10         ` Marshall
2017-12-11 17:29       ` Yawar Amin
2017-12-11 17:59       ` Ian Zimmerman
2017-12-11 18:30     ` Gerd Stolpmann
2017-12-13  8:22       ` Sebastien Ferre
2017-12-13  9:26         ` Evgeny Khramtsov
2017-12-13 10:37           ` David Allsopp
2017-12-13 16:38             ` Marshall
2017-12-13 16:44               ` Yawar Amin
2017-12-13 17:20                 ` David Allsopp
2017-12-13 17:51                   ` Yawar Amin
2017-12-13 17:39         ` Hendrik Boom
2017-12-13 17:55           ` Robert Muller
2017-12-13 18:19             ` Viet Le
2017-12-13 19:29             ` Yawar Amin
2017-12-13  8:55 ` Nicolas Boulay

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=e395579f-bd3f-124e-5aa3-2c7c430c7411@xtuc.fr \
    --to=sven.sauleau@xtuc.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).