Live data from Hacker News

Reason React 0.8

github.com

21–30 of 85 posts

Re: Reason React 0.8

#21
post #15
post #12

Earlier quoted context omitted.

As far as editor support, I have used reason-language-server ( https://github.com/jaredly/reason-language-server ) with Emacs (current), Vim and VSCode (provided through reason-vscode plugin). I used to use IntelliJ, and there was a solid plugin for that as well. ReasonML's compiler is way faster than Typescript's.

There's a difference between "the compiler is faster when run at the CLI" and "the language server is faster". A good language server remains responsive by doing quick, partial compilations on just the section that changed. A bad language server just wraps the standard compiler and re-runs the whole thing when a file is saved. The latter will eat up CPU/RAM and make for a frustrating dev experience, no matter how rel…

OCaml (the Reason compiler) has historically had excellent (and fast) editor support tooling: Merlin.[1] That is now being packaged up as a language server (i.e., LSP).[2] Once you try a Merlin-based editor addon, everything else will seem dog-slow.

[1] https://github.com/ocaml/merlin

[2] https://github.com/ocamllabs/vscode-ocaml-platform

Re: Reason React 0.8

#22

Hey there, is there a `styled-components` library for Reason? I'm really considering ReasonML for my app, however I'm not a big fan of the styling in reason react.

styled-ppx is young but looks promising. Here a twitter thread about it by the author: https://twitter.com/davesnx/status/1249772395658960897?s=20

https://github.com/ahrefs/bs-emotion seems to be more mature. styled-ppx is built on top of it (seen within styled-ppx readme)

Re: Reason React 0.8

#23
post #5

The long awaited 0.8.0 release from Reason React is out of beta! This includes a lot of the niceties of writing React but in a very fast, type safe language. If this is your first time hearing about Reason, watch a video from its creator (Jordan Walke, creator of React) to learn more: https://www.youtube.com/watch?v=5fG_lyNuEAw&t=11s Fun facts about Reason: - exports TypeScript! If you have a TS project and looking f…

Congratulations on the release! I have a couple questions for you (and any other contributors!) about the project, but I don't know how to phrase them without coming off as combative. Please accept the following as genuine curiosity rather than malice. 1) You called the 0.8 release "huge" in the release notes, even though it adds 11 new functions, removes 2, and updates 2 compared to 0.7, released a year prior. Is th…

I'm not OP but I work on ReasonReact. I think these are excellent questions - thanks for asking despite your worries about tone.

1. I would not classify this release as huge by most definitions, but I do think it is by a couple. First - it has many more contributors (both in code and on issues) than the 0.7 release and that means better reflection of community desires and direction. Second - it is the first release that forces 7.x BuckleScript which sets up ReasonReact for optimizations that would be impossible otherwise. Better support for `lazy`, `context`, and more.

2. BuckleScript is a true fork of OCaml and that comes with tradeoffs. On the plus you get JS interop you cannot achieve with JSOO (records and modules compiling to objects, https://bucklescript.github.io/blog/2020/03/26/generalize-un...). On the downside, active effort must be made and prioritized to upstream and maintain course with OCaml proper.

2a. Reason is being used in production at Facebook today, but Facebook also employs many of the people working on it. I personally consider it to be in a stable state for production use, but same as any technology I think it would be foolish to adopt Reason without better understanding the reason it exists, the problems it's trying to solve, and the drawbacks it has.

Re: Reason React 0.8

#24
post #3

The long awaited 0.8.0 release from Reason React is out of beta! This includes a lot of the niceties of writing React but in a very fast, type safe language. If this is your first time hearing about Reason, watch a video from its creator (Jordan Walke, creator of React) to learn more: https://www.youtube.com/watch?v=5fG_lyNuEAw&t=11s Fun facts about Reason: - exports TypeScript! If you have a TS project and looking f…

Awesome! Question, say you use TypeScript already, what are the biggest tangible gains in terms of safety (measured by fewer bugs in production) you think can be achieved by using Reason?

- Full-fledged support for pattern-matching exhaustiveness check, not something you have to bake together using a 'tag' field. This means if you match on i.e. integers, the compiler will warn you if you don't include a catch-all default case.

- Simple module system where you don't need to deal with named vs default imports and all the weird bugs getting them mixed up can bring

- TypeScript's inherent JS-like nature can pop up subtle bugs like forgetting to type a pair of parentheses:

    function isSupported(): boolean {
      return false;
    }

    function test() {
      console.log(true && isSupported); // true
    }
Or doing object/array indexing and forgetting to handle the case of 'undefined' because TypeScript doesn't enforce that. Or how any typings from before version 2 are suspect because they were written with the assumption that every type can be implicitly nullable. There are lots of these little footguns all over the place.

- Higher-quality bindings: more stuff captured at the type level, you're not left to deal with bindings full of 'any', 'object', and 'function'

It's not even just about safety though. One of the biggest productivity drivers in Reason is its iteration speed–the compiler is so fast that you can try out changes basically as fast as you can save the file. And there are other things, like how all modules are implicitly available in scope, so you don't need to manage a 'wall of imports' at the top of every file before you can actually get to the code itself.

Re: Reason React 0.8

#25
post #15
post #12

Earlier quoted context omitted.

As far as editor support, I have used reason-language-server ( https://github.com/jaredly/reason-language-server ) with Emacs (current), Vim and VSCode (provided through reason-vscode plugin). I used to use IntelliJ, and there was a solid plugin for that as well. ReasonML's compiler is way faster than Typescript's.

There's a difference between "the compiler is faster when run at the CLI" and "the language server is faster". A good language server remains responsive by doing quick, partial compilations on just the section that changed. A bad language server just wraps the standard compiler and re-runs the whole thing when a file is saved. The latter will eat up CPU/RAM and make for a frustrating dev experience, no matter how rel…

1. The language server, reason-language-server is written in native Reason and is _very_ fast.

In terms of compiler speeds, Draftbit has 1,000 ReasonML components and about 100 TypeScript files.

I can safely build AND type the entire ReasonML project before TypeScript returns the type results in watch mode.

Re: Reason React 0.8

#26

Hey there, is there a `styled-components` library for Reason? I'm really considering ReasonML for my app, however I'm not a big fan of the styling in reason react.

styled-ppx by @davesnx is a great option https://github.com/davesnx/styled-ppx

At Draftbit we've been using https://tailwindcss.com with @dylanirlbeck's https://github.com/dylanirlbeck/tailwind-ppx with great success!

We also use `bs-emotion` (which on the styled-components vs. emotion api side is the same)

Re: Reason React 0.8

#27
post #3

The long awaited 0.8.0 release from Reason React is out of beta! This includes a lot of the niceties of writing React but in a very fast, type safe language. If this is your first time hearing about Reason, watch a video from its creator (Jordan Walke, creator of React) to learn more: https://www.youtube.com/watch?v=5fG_lyNuEAw&t=11s Fun facts about Reason: - exports TypeScript! If you have a TS project and looking f…

Awesome! Question, say you use TypeScript already, what are the biggest tangible gains in terms of safety (measured by fewer bugs in production) you think can be achieved by using Reason?

1. Pattern Matching

Pattern matching has been by far my most favorite feature as someone coming from TypeScript: https://gist.github.com/peterpme/10840585ddced15a7f4ecd05394...

The ability to use "constants" that are inherently typed mean less mistakes and a better path forward for handling your application state.

Refactoring with this in mind, becomes a lot safer. For example, if I had a reducer that needed a new action, I would add that action to the `type`. The compiler would then tell me every place I needed to handle that case.

2."Implicit" Types (types that don't get in the way)

I don't need to type everything like I would in TypeScript. ReasonML already figures all of that out for me. I _can_ add the type if I want (for readability purposes). There is no such thing a `any` or any type of escape hatch for that (this can be frustrating at first) but once you get it, you write code more confidently.

3. React & Refactoring

Say I've got a bunch of React components I need to refactor. Reason types both the prop key and value. If I remove a prop or change that prop's data structure, I'll immediately know all the places I need to make that change.

I know some folks may roll their eyes when they read this, but after using both Reason and TypeScript at Draftbit, I strongly believe it's a competitive advantage. The stuff we ship in Reason just doesn't break.

Re: Reason React 0.8

#28
post #5

Earlier quoted context omitted.

Congratulations on the release! I have a couple questions for you (and any other contributors!) about the project, but I don't know how to phrase them without coming off as combative. Please accept the following as genuine curiosity rather than malice. 1) You called the 0.8 release "huge" in the release notes, even though it adds 11 new functions, removes 2, and updates 2 compared to 0.7, released a year prior. Is th…

1) You can see a complete list of changes here https://github.com/reasonml/reason-react/blob/a70d9e6b51ed0a... . We consider it a huge release partly because it adds some long-awaited bindings, partly because of the documentation improvements, and partly because of how community-driven the release was. 2) BuckleScript's creator works for Facebook and has both a specific focus and a long-term vision for the project, m…

To clarify, the link in 1) is where I took the number of changes from.

And Re: 2) I have no doubt that Mr. Zhang knows what he's doing. I was just noting how even after the prodigious amount of work he has put into BS over the years, it is still falling behind JSOO which has the benefit of being more tightly bound to the parent OCaml project. I know about the different tradeoffs JSOO and BS have made. All I meant to say is that one super-productive person is apparently (and understandably) not able to keep up with upstream (i.e. Inria + Jane Street + many others) in this case. And then we have the ReasonML project that has seen even less activity recently. If ReasonML in its current state is considered a finished product that requires minimal maintenance, I couldn't think of a better endorsement, to be honest.

Re: Reason React 0.8

#29
post #28

Earlier quoted context omitted.

1) You can see a complete list of changes here https://github.com/reasonml/reason-react/blob/a70d9e6b51ed0a... . We consider it a huge release partly because it adds some long-awaited bindings, partly because of the documentation improvements, and partly because of how community-driven the release was. 2) BuckleScript's creator works for Facebook and has both a specific focus and a long-term vision for the project, m…

To clarify, the link in 1) is where I took the number of changes from. And Re: 2) I have no doubt that Mr. Zhang knows what he's doing. I was just noting how even after the prodigious amount of work he has put into BS over the years, it is still falling behind JSOO which has the benefit of being more tightly bound to the parent OCaml project. I know about the different tradeoffs JSOO and BS have made. All I meant to…

ReasonML is an umbrella project/sponsor for many subprojects, all of which have the goal of bringing fully type safe, fast compiling, fast executing code to the widest number of developers and today that means JavaScript developers. Many ReasonML projects support or improve upstream OCaml ecosystem. For example, package management workflows (https://esy.sh), interactive repls that work with Reason syntax, and OCaml syntax (see https://sketch.sh), and many community members contribute to the developer tools (next generation language server created by OCamlLabs). Others are building CI infrastructure, and many other projects. Reason Syntax was the first entry into the ecosystem. It's not done evolving/improving, and it's just the tip of the iceberg for all the projects under the umbrella. BuckleScript has been developed with Reason users in mind. Syntax is one of the most important things when introducing a language, and one of the biggest tripping points for new people trying out OCaml so it makes sense that it would be the first entry. But it's not the last, it's not the only, and it's not finished evolving/improving.

Re: Reason React 0.8

#30
post #28

Earlier quoted context omitted.

1) You can see a complete list of changes here https://github.com/reasonml/reason-react/blob/a70d9e6b51ed0a... . We consider it a huge release partly because it adds some long-awaited bindings, partly because of the documentation improvements, and partly because of how community-driven the release was. 2) BuckleScript's creator works for Facebook and has both a specific focus and a long-term vision for the project, m…

To clarify, the link in 1) is where I took the number of changes from. And Re: 2) I have no doubt that Mr. Zhang knows what he's doing. I was just noting how even after the prodigious amount of work he has put into BS over the years, it is still falling behind JSOO which has the benefit of being more tightly bound to the parent OCaml project. I know about the different tradeoffs JSOO and BS have made. All I meant to…

There must be a misunderstanding here, maybe on my side, but I honestly can't see how BuckleScript is 'falling behind': it jumped from 4.02.3 to 4.06 fairly recently, with more upgrades planned, and there is ongoing work to make it emit JS that looks more and more hand-written. Its download count looks like hockey-stick growth: https://www.npmtrends.com/bs-platform

Look, JSOO is great but it has a very different goal from BuckleScript: letting OCamlers use the Opam ecosystem to make frontend apps without caring about bundle size. And that's great, but it's not what JavaScript developers want.

Post reply on HN