1,558 karma · joined June 12, 2013
https://twitter.com/jordwalke
It would still be told to record the reasoning somewhere centralized.
And there are in fact issues with using x => y syntax for lambdas without a leading fun/fn keyword:
let x = (this, is, a, really, long, thing ) => 10;
- In that example it's not possible to tell if the leading ( is the start of a pattern for the sake of lambda, or a tuple. This happens with ES6 today as well (destructured record argument). It's not just a matter of human readability, it's a matter of building an efficient parser.
- The (x : y) syntax for type annotations is not new or weird to many people. That's the syntax used by ML, OCaml, and JS (Flow).
- We're likely going to swap some operators for string concat, so that it would be the more common ++ operator.
- The rest of the observations are good and we should address them soon.
Since you mentioned it, Rust looks great too, IMHO. The more we can do to bring statically typed safety to the world, the better, I say.
Reason's goal is to make a great new "interface" to a language that is already great.
Reason currently fixes the most widely cited issues with OCaml's syntax, while curating, refining, and connecting the best tools that already exist for OCaml. We've made some progress, but there's much to do and it's the kind of work that takes a cross-organizational effort, which is why Docker, University of Cambridge's OCaml Labs, Jane Street, Frederick (core Merlin developer) and many others have all contributed, either by implement features or consulting on how to best utilize/connect the tools that exist.
http://facebook.github.io/reason/
You can check out the original HN post here: https://news.ycombinator.com/item?id=11716975
If I understand what you're saying, you provided a reason why variant arguments should not look like function application (because they have different semantics than function application), and then in the same paragraph suggested that variant arguments should have tuple syntax, while admitting that they don't actually have tuple semantics either.
The truth is that variant arguments in `Reason` actually do not have function application syntax - note the distinguishing, leading capitalized letter on the variant. Sure, they share the fact that arguments are specified via a space separated list, but function application doesn't have a monopoly on the syntactic pattern of things separated by spaces. The argument quickly breaks down.
Jokes aside, what would your highlighting do in this case?
This is for those people who do not like OCaml because of those warts. If you are one who is already sold on OCaml, it's very easy to forget how many there really are.
Regarding "Build Systems Rapidly": Please hang in there and stay tuned. The syntax is there to help people learn ML rapidly. The Merlin integration and syntax formatting tooling is there to help people become productive rapidly inside their editors. Next, we have specified a workflow for actually building systems rapidly (as in compiling large projects with namespacing rules).
Instead of our previous approach where we just drop a more polished project with many of the goals accomplished, this kind of project benefits from expertise that is distributed across the entire industry and for that, it's better to be open earlier. I hope you can appreciate and encourage this kind of openness.
So I hope this helps explains why many people feel that compiling to JS is important, even if the syntax/semantics of JS are not equally sought after by those same people.
At the same time, we can't overlook that JavaScript has become one of the most popular languages today. If that were the case thirty years ago, I'm sure the syntax for the ML family would have taken that into account somehow, at least to convey the parts of the two languages that actually are similar - even if only for things as simple as comments. So at least in this V0.0.1 of Reason, some of the things that just don't matter tend to look like things that are familiar to a larger set of people.
I think you've picked up on what looks like an inconsistency in messaging so thanks for pointing it out. I can't speak for everyone else who works on Reason, but I see the two major components (compiling to, and resembling) JavaScript to be largely independent. We can want to compile to JavaScript for totally different reasons than we want some pieces of the grammar to resemble JavaScript and I believe that is the case here. The pieces that currently resemble JavaScript are that way simply because those pieces don't matter too much and why not just be familiar? There are certain syntax features of JS that members of the JS community would tell you were mistakes, and we're not looking to recreate them just for the sake of being like JS.
Which with OCaml, is not an issue thanks to the decent type system!
I agree with you - there is something to be said for just not going against the grain where you can tolerate it. I ask myself, "Are semicolons really the hill I want to die on?".
I agree with you but one benefit of `fun` is that it aligns better with multiples of two spaces. It's important when lists end up wrapping:
/* Nice multiple of two spaces */
fun myFun
xyz
abc => {
doSomeThings(xyz, abc);
};
/* yikes, only one horizontal space between
* doSomething and abc on the line above */
fn myFun
xyz
abc => {
doSomeThings(xyz, abc);
};
I'm obviously no stranger to bike-shedding!I've mentioned elsewhere that the primary goal for now was to get the tooling automated as much as possible, so that when we receive common feedback, we can adapt to that feedback and trivially migrate people's code forward.
I don't think JavaScript's syntax is a selling point and I am someone with a lot of JavaScript experience. I also don't think that OCaml's syntax today is a selling point, and I have a bit of OCaml experience. Both of these syntaxes have evolved over time, working within that limited precious syntactic real estate, trying so very hard to maintain compatibility with decisions made decades ago. Reason's approach is totally different in that it knows we won't get it right on the first shot so it puts into place the tooling for upgrading and beautifying as we learn lessons and take feedback from the community. It places the syntax closer to the user, even if only conceptually.
That being said, the current syntax is not intended to be a JavaScript clone by any means. It actually started in the opposite manner - by taking the top 15 complaints about OCaml's syntax, by experienced OCaml programmers (not JS programmers) and fixing them. There were a couple of things that didn't really matter (such as how you express comments) that were just changed to be more familiar because, well.. simply they don't matter, and even experienced OCaml developers want the largest possible set of people to be able to read their code as long as that comes with little other tradeoffs.
- Teaching new programmers how to use ML, and OCaml in particular.
- Keeping consistent formatting rules among a large team or project and automating that within your editor.
- Benefiting from the comprehensive pattern matching checks provided by the OCaml compiler.
- Benefiting from faster compile times of `ocamlc`, or faster native execution time of `ocamlopt`.
- Benefiting from Merlin, and the new version of Merlin with support for Reason - I cannot overstate how important Merlin is to my daily development.
Soon:
- Having conventions for forming namespaces within packages.
- Making it easier to share and connect many small packages into a a larger application, and develop those packages locally.
- Having "just works" support for the REPL, so that it's one fast command to start the REPL with all your dependencies loaded and autocomplete would just work.
- Having a "just works" debugger loader that maps all of your source files and compiled artifacts so you can instantly start debugging your app.
You can even upgrade your existing OCaml source code to be in the Reason style by using the versatile `refmt` program that is included.