Live data from Hacker News

Reason: A new interface to OCaml

facebook.github.io

181–190 of 294 posts

Re: Reason: A new interface to OCaml

#181

I started off a bit skeptical with the What's OCaml's status with multithreading? Are there any proposals for more flexible operators, so there doesn't need to be different operators for different numerics? (F# solves this by allowing inlined functions.)

Yeah, I feel the same way about <-, but it's interesting to know that Elm did the same thing, so it isn't a random change.

Re: Reason: A new interface to OCaml

#182
post #109

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

I know the Haxe compiler is written in Ocaml, and that's a decent size open source project. I believe Facebook uses it for a number of their programming language related tools too. It seems to gave a sweet spot for writing language parsers and compilers.

Re: Reason: A new interface to OCaml

#183

Earlier quoted context omitted.

Looks like their plan is to reuse the ocaml compiler backends that output javascript; but it doesn't sound like they're doing anything explicit to promote Reason -> Javascript compilation.

Well, if you ignore the red button that runs you through comparisons of different Javascript syntax to the equivalent Reason syntax, then sure, they aren't doing anything explicit...

That's a comparison of syntax, which has nothing to do with compiling to Javascript.

Re: Reason: A new interface to OCaml

#184

I took ocaml for a spin a couple months ago and compared to more recently created languages it seems a bit crufty. If they can simplify the build system to be on par with something like cargo that would be swell. Also: having rust style traits or haskell classes would be amazing. Also macros that aren't obscure and hard to use compiler plugins please :) Hopefully it ends up being more than just questionable sugar aro…

I agree on the build system and macros. As for traits/type classes, there's work being done on implicit modules to fill that role. [1]

[1] http://www.lpw25.net/ml2014.pdf

Re: Reason: A new interface to OCaml

#185

As excited as I was to see a big new thing in OCaml-land, I have to say my excitement died down as I read on. I don't really see most of the changes as improvements. Having a different, explicitly-noticeable syntax for mutable updates is nice, because it calls out mutability (which should be used sparingly). I don't see extra braces as necessarily an improvement, given that OCaml's local scopes are already quite unam…

Yeah, I kinda feel like this whole project is pointless. As many warts as OCaml's syntax has, for the most part I actually like it.

It seems like Reason is solving a non-problem. When I first went to the webpage, and saw "Build Systems Rapidly", I thought maybe it was a new build system for OCaml. I was hoping it would be a Cargo-style build system/package manager for OCaml.

Re: Reason: A new interface to OCaml

#186
post #143

It seems to me that Rust would be pretty much strictly better than this. In particular Rust has similar syntax, seems to have all Reason's features plus the linear types and regions/borrowing that allow memory and concurrency safety while still being able to mutate memory and not being forced to use GC. They are aware of Rust since they cite it in their page, so I wonder why they decided to create this instead of usi…

Both garbage collected languages and rust offer memory safety, rust just trades better performance for a more complicated borrow system. Use rust when you need the performance. Use a GC'd language like reason when you want less things to reason about.

> rust just trades better performance for a more complicated borrow system.

I would say Rust trades more predictable performance for a more complicated borrow system.

Re: Reason: A new interface to OCaml

#187
post #143

It seems to me that Rust would be pretty much strictly better than this. In particular Rust has similar syntax, seems to have all Reason's features plus the linear types and regions/borrowing that allow memory and concurrency safety while still being able to mutate memory and not being forced to use GC. They are aware of Rust since they cite it in their page, so I wonder why they decided to create this instead of usi…

Actually, OCaml has plenty of features that Rust doesn't have. The ML module system/functors are a big one. Polymorphic variants. Global type inference. GADTs. Garbage collector :).

Re: Reason: A new interface to OCaml

#188
post #55

Earlier quoted context omitted.

I can run the Unreal engine, use google maps but not view your website. I'm not convinced Firefox is at fault here. Is there any interactive functionality that your website offers that would justify extraordinary demands or does it simply display some text and images?

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.

Normally the easy answer is to turn off Javascript, but in this case it makes the whole thing completely fail to render. For a site that's just showing you some text.

Some days you just can't win.

Re: Reason: A new interface to OCaml

#189

Earlier quoted context omitted.

I like the syntax cleanups. What's the advantage of using the existing OCaml toolchain over using an LLVM backend? Expediency and interop with Facebook's other OCaml libraries? From what I have read, the OCaml compiler only does basic optimizations and the runtime has poor multithreading support.

Facebook has many projects that are already written in OCaml, and Reason provides a path forward for seamlessly, and incrementally moving projects over to the new syntax/style. Feel free to take a look at some Reason in the wild, used inside of the Infer project at Facebook: https://github.com/facebook/infer/tree/master/infer/src/IR Apart from that, although syntax is the "user interface" to a language, and user inte…

Cool. Thanks for the background. I'll take a look at the Infer code. :)

Re: Reason: A new interface to OCaml

#190
post #180
post #176

Earlier quoted context omitted.

I've never written OCaml, just SML and F#, but I thought that OCaml didn't have the |> operator.

OCaml, like SML, have the syntax for defining their own operators. |> is defined, to my knowledge, both in the standard prelude and in core.

Since Ocaml 4 if I remember correctly
Post reply on HN