Live data from Hacker News

ReasonML – React as first intended

imaginarycloud.com

181–190 of 190 posts

Re: ReasonML – React as first intended

#181

Earlier quoted context omitted.

> There's no ignoring going on. Reason exists on its own because it's not opinionated on what sort of app you're trying to build I think either I wasn't clear, or you completely misunderstood me. My point, that Reason should have a standalone installer or package that gives you a working Reason as simply as possible without a whole build infrastructure required, is only bolstered by this statement. I don't think it m…

I'm still not sure I understand. Are you complaining that Reason's distribution is optimized for JavaScript developers?

No, I'm complaining it's not optimized for the person that just wants to try it out in any way. Not everyone is using npm or already has Ocaml on their system. Making them install that entire toolchain first to try our Reason locally, is sort of crazy, it's just not the crazy that's easily seen when the costs are already completely amortized because you're a Javascript or Ocaml programmer already.

And locally is important, since they might want to try a simple app with it, and not want to set up a whole Javascript dev toolchain with webpack. Sure, they might end up going that way eventually, especially if they choose Reason and or React and integrate it into their project, but for a test drive, requiring it is a large hurdle and a lot more to keep track of.

Reason's current distribution method is akin to Python requiring the installation of a C compiler toolchain so you can download the source and compile. To be sure, that's a wanted distribution method of an open source project like that, but they've rightly recognized that as the only distribution method it would hamper adoption, especially on platforms where that toolchain is harder to get set up.

I'm not even suggesting Reason go as far as that, exactly. I'm suggesting Reason ship a tarball/zip with a directory structure that includes Node and a set of pre-installed packages that provide Reason/Bucklescript. Installation instructions would include setting a few environment variables (altering PATH, telling Node where to look for packages). Or instead of Node/npm, provide Ocaml/OPAM with the correct packages pre-installed (although that might be slightly harder due to an increased amount of binaries as opposed to interpreted scripts as with JS). Or both in the same package, if it's not an excessive amount of work.

I understand it's a lot of work, but at a certain point, expecting prospective users to install a whole toolchain not for your language, but for the hosting language, just so they can test it out your language ends up being limiting. You've said that Reason isn't trying to be opinionated in what kind of app you're trying to build, but I think it's still being very opinionated in the exact process required to build that app. It's just that you allow for two opinions instead of one.

Hopefully that's clear enough, and you understand this comes from an actual desire to make Reason better. I spent a couple weeks in my spare time earlier this year evaluating whether Reason would work well for a new project I was starting, and I was extremely excited by the possibility of a shared front-end/back-end codebase that could be compiled to binaries when needed for performance reasons. That ended up not working out because I think the ecosystem isn't quite there yet for that exact need (e.g. a good framework and ORM that's mostly in Reason, and doesn't require converting from Ocaml to reason, etc), but a big takeaway I got from that was that as someone not invested in the Node module ecosystem that much, setting that up, and in a way that was repeatable and documented, is painful, and that ended up counting against Reason in the end because I would undoubtedly have to deal with that. That's not to say I wouldn't with what I'm proposing, but if I'm already on the Reason cheer squad that's less of a problem, language adoption-wise.

Re: ReasonML – React as first intended

#182

Earlier quoted context omitted.

I'm not sure what the connection is here. Is it because Facebook sponsored development of Reason? Should we consider not using anything that Facebook touches? What if Facebook pays a developer to work on another popular library like Vue.js? Should we consider stop using Vue?

As far as I know, they aren't a sponsor of the project -- they own the project (as opposed to something like Cassandra). Companies release these libraries because they benefit the companies. The successes of projects like React help Facebook. I think that people who believe that Facebook is an unethical company should consider alternative technologies on new projects whenever possible.

> Companies release these libraries because they benefit the companies. The successes of projects like React help Facebook.

The success of projects like Haskell and OCaml help Facebook too. Should we consider not using those technologies?

It seems the only difference you can point out is that Facebook "owns" React. But this doesn't make any practical difference when it comes to open source. It's like public transportation. If Facebook sponsors a high-speed railway that benefits both them and two cities, so what? That's great for everyone.

If you were talking about a paid SaaS run by Facebook, then I would agree with you. That would be more analogous to supporting Uber than supporting public transportation.

Re: ReasonML – React as first intended

#183

Earlier quoted context omitted.

I'm still not sure I understand. Are you complaining that Reason's distribution is optimized for JavaScript developers?

No, I'm complaining it's not optimized for the person that just wants to try it out in any way. Not everyone is using npm or already has Ocaml on their system. Making them install that entire toolchain first to try our Reason locally, is sort of crazy, it's just not the crazy that's easily seen when the costs are already completely amortized because you're a Javascript or Ocaml programmer already. And locally is impo…

Everything I've heard suggests ReasonML is targeted primarily at developers currently using NPM and working in that stack. I don't think creators of a tool have a moral obligation to make it easy to use for everything. Most things have an intended focus, and some happen to be really good for all kinds of other stuff too. That being said, it does sound like it would be cool for it to be easier to install without that dependency.

FWIW, Scala and Clojure require the JVM to work at all, and both are pretty popular.

Re: ReasonML – React as first intended

#184

Earlier quoted context omitted.

How's Clojurescript interop story? what always holds me from using these compile to JS langs is the fear that the gains you get from using a better/nicer language are completely destroyed by all the interop churn.

As someone who's done a bunch of interop in ReasonML & ClojureScript, ClojureScript interop blows ReasonML away (in terms of ease) at the language level. The current problem with ClojureScript interop is the Google Closure compiler's support for stuff on npm. I switched our team to using shadow-cljs[0] and it solved all of those problems. Would highly recommend. [0] http://shadow-cljs.org/

Ok thanks, I know this can be highly subjective but which do you prefer between the two (reason and cljs) and why?

Re: ReasonML – React as first intended

#185

Earlier quoted context omitted.

As far as I know, they aren't a sponsor of the project -- they own the project (as opposed to something like Cassandra). Companies release these libraries because they benefit the companies. The successes of projects like React help Facebook. I think that people who believe that Facebook is an unethical company should consider alternative technologies on new projects whenever possible.

> Companies release these libraries because they benefit the companies. The successes of projects like React help Facebook. The success of projects like Haskell and OCaml help Facebook too. Should we consider not using those technologies? It seems the only difference you can point out is that Facebook "owns" React. But this doesn't make any practical difference when it comes to open source. It's like public transport…

Facebook's use of software is completely different than a product of Facebook that targets programmers. Companies release open-source libraries because they benefit the companies.

Re: ReasonML – React as first intended

#186

Earlier quoted context omitted.

As someone who's done a bunch of interop in ReasonML & ClojureScript, ClojureScript interop blows ReasonML away (in terms of ease) at the language level. The current problem with ClojureScript interop is the Google Closure compiler's support for stuff on npm. I switched our team to using shadow-cljs[0] and it solved all of those problems. Would highly recommend. [0] http://shadow-cljs.org/

Ok thanks, I know this can be highly subjective but which do you prefer between the two (reason and cljs) and why?

I really like both languages. Like, a lot. They both tick all the boxes of:

1. Immutable by default (with sane escape hatches) 2. Fully qualified namespaces 3. Functional (with sane escape hatches) 4. Good interop with host platform

At the beginning of this year, my team started a green field project to replace our old system. I had the chance to steer us toward ReasonML or Clojure(Script), and we decided on Clojure.

The main reasons were:

1. The number and maturity of libraries for Clojure(Script) was much higher 2. Clojure's server-side story was much better, and we needed to write a ton of services as well as client-side code 3. The ecosystem, language & tooling was much more stable for Clojure back then

I think that ReasonML has a ton of great ideas, it just lacks maturity. I love the language itself, but I would not yet want to inflict it upon my team mates who have spent the last 10 years writing Java back-end services. Clojure(Script) ended up being a much better fit and I feel like I am just as productive, if not moreso, than when I was writing code in ReasonML.

Re: ReasonML – React as first intended

#187
post #179

Earlier quoted context omitted.

Yea, thays been very much my experience as well. Still a little bit off usable imo, docs are still very iffy, and there's only really Real World OCaml as a great learning resource for the actual language. refmt formatting drives me a bit nuts, especially the.lines thing; it's steadily improving though. One thing though - Belt is the WIP standard library (so OCaml), whereas JS is just bindings to JS, they're very diff…

I don't know where (or if) |. is documented, I think I saw someone use it in a Github thread somewhere. I use it all the time – for instance someList |. Belt.List.map(i => i + 1) ... because most Belt.List functions take the list as the first argument, and |> feeds its input as the last argument. Edit: apparently |. is BuckleScript, lots more discussion here: https://github.com/facebook/reason/issues/1452 ... just an…

Ah, that makes sense. But that's, afaics, a completely undocumented operator which breaks standard (subject last) ML convention - I get why it's very useful for interoperability with JS but jeez that isn't great work on the documentation front; I've been using Reason for small personal projects and libraries for the last six months and didn't even know that was a thing that had been defined

Re: ReasonML – React as first intended

#188
post #133

> A while ago I've written a series of articles about the Elm language and they are not that different from each other. The main difference IMO is that Elm is not really a general purpose language, you must use the Elm architecture to use it. It is only meant for frontend web applications.

http://package.elm-lang.org/packages/chrilves/elm-io/1.2.1hi... elm is a frontend language, you are not forced to use tea. You can bypass the `program` entry point and use monadic-style command chaining for instance.

Re: ReasonML – React as first intended

#189

Earlier quoted context omitted.

ReasonML has more potential. Aside from its excellent type system (one of the best), it can also compile to native code. This has several benefits: - Frontend: Your tools are fast. The ReasonML-to-JS compiler is already an order of magnitude faster that TypeScript, etc. Fastpack is a native bundler in the works that aims to bundle your project in under a second (and faster for incremental builds). - Mobile & Desktop:…

Yeah. The OCaml compiler is just crazy fast. It's like Go, but with a super nice functional language. The compiler seems to be doing a heck of a lot of heavy-lifting in such a small amount of time. I'd be interested in a talk about how it manages that, if anyone knows of one.

A lot of the tooling speed comes from a couple places:

1. The compiler optimizations being applied to code - Things like GADT's are able to be allocated very efficiently - Can generate code that doesn't box at runtime (smash it into a pointer is done as well) - Pointers are word-aligned

2. The OCaml runtime - No JIT - No warmup - Can emit native code

3. The HM type system - Typecheckers for HM are really simple [1]

[1] https://en.wikipedia.org/wiki/Hindley%E2%80%93Milner_type_sy...

This simplicity + the features of the compiler combine to make the OCaml compiler very fast, and very easy to write one (some undergrad CS classes do), and developer-time tenable to make both happen.

Re: ReasonML – React as first intended

#190
post #188
post #133

> A while ago I've written a series of articles about the Elm language and they are not that different from each other. The main difference IMO is that Elm is not really a general purpose language, you must use the Elm architecture to use it. It is only meant for frontend web applications.

http://package.elm-lang.org/packages/chrilves/elm-io/1.2.1hi... elm is a frontend language, you are not forced to use tea. You can bypass the `program` entry point and use monadic-style command chaining for instance.

Sorry on the late reply, but your URL fails and I'm not sure I follow what you're talking about. I enjoyed Elm quite a bit @ version 0.16, then they got rid of signals and forced everyone to use TEA. To say that they aren't forcing you to use it isn't true. AFAIK, you can't even publish a module that interfaces with javascript without Evan's permission.
Post reply on HN