HNHacker News
TopNewBestAskShowJobs

jordwalke

1,558 karma · joined June 12, 2013

Building things at Facebook: React. ReactNative. ReasonML.

https://twitter.com/jordwalke

submissionscomments
jordwalke··on Reason: A new interface to OCaml
To start, we have "fixed" type parameter application syntax. (Most people see this as a win and now matches Haskell IIRC). Some have requested ability for type annotation ayntax to be above the value it annotates.
jordwalke··on A Docker file for Reason development
I'm impressed at how little bike shedding has actually occurred for people that are helping out. I suspect it's because we know we aren't heavily locked in, and we can automatically upgrade to the new version of the syntax.

It would still be told to record the reasoning somewhere centralized.

jordwalke··on Reason: A new interface to OCaml
You don't know of any other languages that use `mod` to represent "module"? Say, perhaps, the one you just advocated for in another thread?

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.

jordwalke··on A Docker file for Reason development
I think you're taking my lightheartedness far too seriously. Fwiw, I would be just as happy to have `fn` represent lambdas if enough people felt similarly. We're certainly receptive to feedback which is one of the reasons why we're open sourcing this at a relatively early stage and collaborating with other organizations.

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.

jordwalke··on Reason: A new interface to OCaml
It doesn't have to be three letters, keywords can be odd numbers and achieve a similar effect - also, we likely will use the `mod` keyword instead of `module` fwiw.
jordwalke··on A Docker file for Reason development
Since the original link was missing some context:

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

jordwalke··on A Docker file for Reason development
I stand by my bike shed :D

https://news.ycombinator.com/item?id=11718769

jordwalke··on Reason: A new interface to OCaml
Except when you're in the top level - in which case you don't use `in`. Oh, and don't forget all the nuance of interleaving imperative commands. I'm an experienced OCaml dev and this trips me up (the "ml compared" section of the docs lists some common pitfalls that Reason resolves).
jordwalke··on Reason: A new interface to OCaml
Glad to hear it! We've also tossed around the idea of having a precompiled standard lib come with it upon installation. We're certainly not looking to increase the number of standard libraries, when there's already so many to choose from, but including/pre-building/curating is certainly within the scope.
jordwalke··on Reason: A new interface to OCaml
> In OCaml they are not first class, that is, you can't pass the as arguments, or partially apply them. That's why it makes sense for the declaration to look like a tuple, and the use to look like a function applied to a tuple--well, somewhat, you can still argue that it's still confusing because you might expect to be able to apply the constructor to a tuple variable, but well, such is life

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.

jordwalke··on Reason: A new interface to OCaml
When we start talking about syntax coloring, you know we're just one step closer to actually debating the color of a literal bike-shed!

Jokes aside, what would your highlighting do in this case?

jordwalke··on Reason: A new interface to OCaml
In 2016, "marketing to JavaScript programmers" is pretty much the same thing as "marketing to programmers". Providing context that the vast majority of programmers will understand is helpful regardless of the compilation strategy. That being said, of course people want a language that can compile to JavaScript, and it's worth mentioning the expanding set of options for doing so. But the syntax comparison really would be worthwhile even if it weren't the case, if only to provide context to what is likely the largest developer community that exists today.
jordwalke··on Reason: A new interface to OCaml
Yes, I'd describe it as being "non-invasive". It means we get the benefit of literally every feature implemented in the core of the language (multicore, F-lambda, modular implicits, ppx attributes), but can decouple the process of deliberating over how this is presented to the user, and (not to beat a dead horse) but we don't even have to worry about getting it right on the first try! Now that I've embraced this as the new "normal" way, I couldn't imagine having to design a syntax and stress over having to determining the exact permanent concrete syntax that needs to live virtually forever without knowing which other language features will be added later.
jordwalke··on Reason: A new interface to OCaml
"As many warts as OCaml's syntax has, for the most part I actually like it."

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.

jordwalke··on Reason: A new interface to OCaml
I personally think that JavaScript is one of the most meaningful and important languages that exists today. This needn't imply that JavaScript's syntax, or its semantics are to be emulated (though we're seeing a bunch of welcome improvements in recent versions of JS). The thing I like most about JavaScript is that it allows anyone, anywhere to easily deploy and share code with anyone anywhere.

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.

jordwalke··on Reason: A new interface to OCaml
Thanks for the feedback. We can change it to `Cons`, but I was assuming that anyone who knew what `Cons` was, would know what `List` meant, but not everyone who understood what `List` meant, would know/recall what `Cons` meant.
jordwalke··on Reason: A new interface to OCaml
> other languages in common use now have it as an assignment operator (even if it is still a source of bugs a la: "if(a=0) ...")).

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?".

jordwalke··on Reason: A new interface to OCaml
Thanks stuartaxelowen, the feedback is actually really valuable one way or another.
jordwalke··on Reason: A new interface to OCaml
I suspect the syntax of `<-` (or lack thereof) will be a common topic of discussion. Let's see how various audiences respond to this change and then discuss if we'd like to restore `<-` for mutation. Personally, I don't use a ton of mutations in my code so I have less at stake and if there's anything we can do to appeal to a wider audience, I'm inclined to give it a shot.
jordwalke··on Reason: A new interface to OCaml
Jordan here (I work on Reason):

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!
jordwalke··on Reason: A new interface to OCaml
It turns out it was the drop shadows, and only were an issue in Firefox. I don't know what to make of the fact that we can run Unreal but we can't render drop shadows performantly. Maybe we should build web pages using WebGL.
jordwalke··on Reason: A new interface to OCaml
Thanks for the (many) reports! It's been fixed for a while. No excuse for poor performance!
jordwalke··on Reason: A new interface to OCaml
Yeah, if you peak inside the source code, you'll see we've implemented a `Reason` binding to the `Atom` JS plugin API.
jordwalke··on Reason: A new interface to OCaml
Jordan here (I work on Reason)

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.

jordwalke··on Reason: A new interface to OCaml
Thanks evincarofautumn! I'll take a look.
jordwalke··on Reason: A new interface to OCaml
For now:

- 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.

jordwalke··on Reason: A new interface to OCaml
What cheng said, but we could also make sure that the syntax for modular implicits plays very nicely with the rest of the grammar. With Reason we can rethink the grammar holistically instead of having to find room in it for new features. The hard part is in the actualy implementation of Modular Implicits, but that's currently being handled by skilled professionals and Reason will be able to use them.
jordwalke··on Reason: A new interface to OCaml
Fixed, thank you @konschubert.
jordwalke··on Reason: A new interface to OCaml
Interop with OCaml is perfect and should remain so. ppx should work (modulo issues that we're not aware of).

You can even upgrade your existing OCaml source code to be in the Reason style by using the versatile `refmt` program that is included.

jordwalke··on Reason: A new interface to OCaml
The Atom Reason plugin uses Nuclide's system for error rendering (in the diagnostics bar), and type hints. But the actual logic for integrating with Merlin has been completely rewritten in Reason itself, and compiled from Reason into JS to run as an Atom plugin. So there are still merlin features missing because the Atom plugin is relatively young, but if you want to help us implement the missing features, it can be a fun way to try Reason itself (compiling to JS).
← PreviousPage 3 of 7Next →