Live data from Hacker News

Reason: A new interface to OCaml

facebook.github.io

201–210 of 294 posts

Re: Reason: A new interface to OCaml

#201
post #146

I hope this doesn't sound like trolling, but JavaScript's syntax is now a selling point? I kinda-sorta get the reason why people want an actual JavaScript stack on the backend, but I never heard that syntax/semantics brought people from e.g. Rails to Node. Sure, OCaml isn't even the nicest syntax in the ML family, but I'm not sure whether that's worth it, especially considering that almost any "X-like" language often…

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…

The top complain I've heard about syntax is that too many people focus on it ;-p

Maybe that's because it's the first and only thing one can see and therefore it's cheap to have an opinion? Or is it because too many professionals are used to languages which are little more than a syntax on top of a toy evaluator?

When I first try ocaml long ago, I though overcoming the syntax would be a huge challenge (especially since I was using lisp at the time). Surprisingly, I got used to it after the first night, and even started to like it. Just a single data point of course, but it seems useful to warn new programmers that your first impressions on the syntax of a language are just that. Also, your estimation of the time that would be required to learn a new language based on how easily you can parse the syntax at first sight is completely wrong. It took me longer to understand some error messages that the compiler threw at me long after I though I could "speak ocaml" than to build an initial understanding of the syntax (roughly 2 hours).

All of the above, of course, is just a disgruntled and grumpy way to say: despite we all know we don't care about the syntax of any language once we know it, it's still an overly important factor to drive a language adoption (or, in the case of ocaml, disaffection). Therefore, let's hope this new "revised syntax" will help many more programmers discover more sophisticated languages than the industry standards!

Re: Reason: A new interface to OCaml

#202

So, I know OCaml is impressively fast. And, I know OCaml is impressively terse ("concise" may be a more positive term). But, I wonder what would make one choose OCaml (or a variant of it like this) over some of the other new or old languages that exhibit some excellent characteristics for modern systems. In particular, a convincing concurrency story seems mandatory. I don't know enough to know if OCaml (or this varia…

Because ocaml type system is state of the art unlike go or elixir.

Also, what's a convincing concurrency story? Does multiprogramming count?

Re: Reason: A new interface to OCaml

#203
post #109

Has anyone here built something say, over 10k lines in Ocaml? How is the development experience? IDEs, debuggers, linters, deployment, etc.

I haven't done anything ≥10k lines yet, but I do have a few projects between 1k and 5k lines that I've been working on and I've easily written 50k+ lines of OCaml in the past year. The development experience I've had is probably the best I've dealt with so far. There isn't a ton of infrastructure around the language, but everything that exists feels very high quality.There's no standard IDE really (although I did recently find OCamlEditor, which seems very nice and even runs on Windows!), but Merlin basically turns any compatible text editor into a full-fledged OCaml IDE (with features like quick-checking code, auto completion, linting, and automatic indentation/formatting). Honestly, debugging isn't something I've had to think of very often. The type system does a really good job of rejecting buggy programs, so whenever I write code it usually works as intended immediately (or I've made a small mistake that I'll notice pretty quickly).

Re: Reason: A new interface to OCaml

#204
post #91

Would be nice to see modular implicits like those that are being proposed for OCaml. It's a shame to not have any form of ad-hoc polymorphism.

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.

Ah, woops - didn't realise that Reason was such a thin syntactic layer over the semantics of OCaml. That approach makes sense then.

Re: Reason: A new interface to OCaml

#205

So, I know OCaml is impressively fast. And, I know OCaml is impressively terse ("concise" may be a more positive term). But, I wonder what would make one choose OCaml (or a variant of it like this) over some of the other new or old languages that exhibit some excellent characteristics for modern systems. In particular, a convincing concurrency story seems mandatory. I don't know enough to know if OCaml (or this varia…

The ML family of languages have https://en.m.wikipedia.org/wiki/Hindley%E2%80%93Milner_type_... which provide many benefits

Re: Reason: A new interface to OCaml

#206
post #96

Earlier quoted context omitted.

The difference between curried langs like OCaml and Haskell and languages like Ruby and Elixir are that the leaving out of parens actually means something, ie. all functions take one argument. If you wanted parens whilst maintaining the same semantics, you would end up having to do write: `add(2)(3)`

Indeed, but leaving out the parens makes more work for humans. What does `a b c` mean? `a(b)(c)`? `a(b(c))`? If the only thing that is gained by leaving out the parens is brevity, I don't think its worth it.

More work for humans used to something else.

At this point it's worth reminding that ML syntax was originally designed to make programs more palatable to maths students...

Re: Reason: A new interface to OCaml

#207

So, I know OCaml is impressively fast. And, I know OCaml is impressively terse ("concise" may be a more positive term). But, I wonder what would make one choose OCaml (or a variant of it like this) over some of the other new or old languages that exhibit some excellent characteristics for modern systems. In particular, a convincing concurrency story seems mandatory. I don't know enough to know if OCaml (or this varia…

For concurrency I found this green thread implementation which uses libev or select for io:

http://ocsigen.org/lwt/2.5.1/manual/

Also, for parallelism, elsewhere in this thread this link was shared:

https://ocaml.io/w/Multicore

Re: Reason: A new interface to OCaml

#208
post #48

This looks very interesting. I've always had OCaml in mind but never actually got around to using it in a project. Facebook could have done a better job describing what exactly this is, but they do provide a good overview at the end of the page (strangely!) [1]. In summary, Reason [2] is a new language (correction: interface to OCaml) that shares a part of the OCaml compiler toolchain and runtime. I don't know of any…

A similar language might be Haxe, which can target C++, Java, C#, PHP, JavaScript, Python, Lua, and Neko languages, and make use of the tooling/build chain for those languages. So you can abstract the syntax from the runtime, but the semantics are often different per target - e.g. accessing the filesystem in Node.js will be different to C++, due to the non-blocking I/O mechanism. As an aside, the Haxe compiler is wri…

> As an aside, the Haxe compiler is written in OCaml. I think there'd be a delicious juxtaposition if it was re-written in Reason. Writing Reason to generate OCaml to create Haxe to generate Java to generate bytecode...

It should be easy to convert the Haxe compiler into Reason with refmt. Maybe unless if it's using camlp4 syntax extension... But I guess you could add a camlp4 pass before running refmt.

Re: Reason: A new interface to OCaml

#209
post #204

Earlier quoted context omitted.

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.

Ah, woops - didn't realise that Reason was such a thin syntactic layer over the semantics of OCaml. That approach makes sense then.

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.

Re: Reason: A new interface to OCaml

#210

So, I know OCaml is impressively fast. And, I know OCaml is impressively terse ("concise" may be a more positive term). But, I wonder what would make one choose OCaml (or a variant of it like this) over some of the other new or old languages that exhibit some excellent characteristics for modern systems. In particular, a convincing concurrency story seems mandatory. I don't know enough to know if OCaml (or this varia…

Because Elixir doesn't target native code and Go type system is not much better than a safe C with interfaces and packages as addition.
Post reply on HN