[HN Gopher] Reason React 0.8 ___________________________________________________________________ Reason React 0.8 Author : thegreatpeter Score : 63 points Date : 2020-05-13 16:19 UTC (6 hours ago) (HTM) web link (github.com) (TXT) w3m dump (github.com) | bgorman wrote: | ReasonML is awesome! I personally preferred the "reducer" state | modeling mechanism from ReasonReact 0.6, but you can still use it | as a library with https://github.com/bloodyowl/reason-react- | update | wwewe wrote: | I ended up just using redux with react-redux. I just wrote my | own bindings (does not cover the entire api surface but the | essentials): | https://gist.github.com/melbourne2991/b3093187505f2ee9e517bb... | | You get a lot of optimizations for free with react-redux. Given | reason-react now supports hooks you can also just use | `useReducer` but this lacks some optimizations. | cosmosocean wrote: | 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. | tsnobip wrote: | I guess this lib would be the closest alternative in a safe | statically typed way : https://github.com/davesnx/styled-ppx | There's also a nice lib for tailwind : | https://github.com/dylanirlbeck/tailwind-ppx | wwewe wrote: | The approach I've been taking is to use ReasonML to model the | domain of my application as well as high level components. | ReasonML code remains unaware of the styling of the "lower- | level" components for the most part, which I write in | typescript with styled-components or emotion. | [deleted] | thegreatpeter wrote: | 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 for | some extra speed & stability, you don't have to sacrifice type | safety interop | | - It powers all of Messenger.com. The team put out a case study | where they went from ~10 bugs a week to less than 10 a quarter by | switching to Reason | | - It uses the npm / yarn ecosystem so you can use your favorite / | current packages without looking for something new. | dmit wrote: | 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 there something else | about 0.8 that makes it larger than the sum of the API changes? | | 2) BuckleScript has seemingly been a one-man show for ~3 years. | It is lagging noticeably behind the progress of the main OCaml | project (including jsoo). ReasonML has a couple prominent | contributors, but the overall (public) activity is dwarfed by | Hongbo Zhang's work on BS. Is this because the ReasonML project | is considered to be in a stable state, sufficient for | production work? | yawaramin wrote: | 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, more | details here: https://www.youtube.com/watch?v=iWEQjvGGiTA . | He also regularly blogs about ongoing improvements: | https://reasonml.org/blog . Facebook Web Messenger and other | products are heavily reliant on BuckleScript. I would | consider that to be production-ready. | dmitriid wrote: | > It powers all of Messenger.com. The team put out a case study | where they went from ~10 bugs a week to less than 10 a quarter | by switching to Reason | | When they did that, I was running into numerous _behaviour_ | bugs on Messenger.com. Anything from weird image uploads to | link previews not showing up in one chat but working in another | etc. | | Reduction in pure code bugs is nice and all, but a very | synthetic and useless metric overall IMO. | Matthias247 wrote: | > - It powers all of Messenger.com. The team put out a case | study where they went from ~10 bugs a week to less than 10 a | quarter by switching to Reason | | Did they move from Typescript or Javascript? | yawaramin wrote: | More details here: | https://reasonml.org/blog/messenger-50-reason | parhamn wrote: | 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? | bgorman wrote: | With ReasonML and other ML languages the type system is | advanced enough to make many error conditions unrepresentable | in the type system, and therefore the bugs move from runtime | to compile time. Typescript has slowly been making its type | system more powerful and exhaustive, but ultimately the fact | that it is a superset of javascript will always keep it from | having the compile time safety you can get in other | languages. | | ReasonML (OCaml) natively supports pattern matching, variants | (Sum types), polymorphic variants, smart constructors, | abstract data types, recursive types, and modules. | | When you know how to use all of these features, you can | prevent a remarkably large surface of bugs from ever | compiling. As a new user, the first feature that will | probably bring a smile to your face is pattern matching with | variants. | | If you are interested I highly recommend the book "Learn | Type-Driven Development" | brundolf wrote: | What's the editor support like? TypeScript has industry- | leading editor integration with insanely fast response | times. I'm always wary of new languages for this reason; | I've been burned before by Facebook's own Flow type system. | dmit wrote: | Reason support in VSCode is very solid. | bgorman wrote: | 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. | brundolf wrote: | 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 relatively-fast the base | compilation time is. | yawaramin wrote: | 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 | [deleted] ___________________________________________________________________ (page generated 2020-05-13 23:00 UTC)