"왜 귀찮게 새로운 언어를 전부 배우죠?"
이 이야기는 Reason에는 적용되지 않습니다.
However, it's unclear which features of JS to reshape, in order to fit it into the mold of a language with fast semantics and 100% sound typing. But we can work backward, from an already sound language with performance and simplicity taken into account, and give it a few tweaks so that it looks and acts a bit more like the better part of the familiar web language we've come to know.
All these decisions made it so that, for common use-cases, the learning curve of Reason isn't really higher than learning JS + a gradual type system; in return, you get:
- 바위처럼 단단한 타입 시스템. OCaml types have 100% coverage (every line of code), inference (types can be deduced and aren't required to be written manually), and soundness (once it compiles, the types are guaranteed to be accurate).
- An eye for simplicity & pragmatism. We allow opt-in side-effect, mutation and object for familiarity & interop, while keeping the rest of the language pure, immutable and functional.
- 성능 & 크기에 초점을 맞춤 Reason's build system,
bsb, finishes building in less than 100ms (incremental). Our produced output is also tiny.
- 멋진 생태계 & 도구 당신이 좋아하는 에디터와 당신이 좋아하는 NPM 패키지, 그리고 당신이 좋아하는 기존의 스택을 쓰세요.
왜 지원 언어가 OCaml 이죠? 왜 [내가 좋아하는 언어] 가 아니죠?
First of all, please understand that no matter which language we choose, we'd get this question from most of you! =)
Many backing languages would satisfy the previous section's points; the points below, however, have been deal-breakers in our considerations.
- Side-effects, mutation & other escape hatches. These aren't usually the shiny selling points of a language; but being able to bridge toward a part of a codebase without an elaborate interop/rewrite is crucial for us at Facebook. OCaml defaults to immutable and functional code, but having the escape hatches makes the initial adoption sometimes simply possible.
- Implementation polish matters. OCaml's been refined over two decades and gets better every year. If we propose a new syntax & toolchain, we'd like it not to have deal-breaking semantics & type "gotchas" and/or diminishing return, 80% onto the writing of a codebase.
- React 작성을 위한 언어. Reason's creator also created ReactJS, whose first prototypes were written in SML, a distant cousin of OCaml. We've transcribed ReactML into ReactJS for wide adoption. A few years later, we're now iterating on the future of ReactJS through ReasonReact.
- 멋지고 또 성장하는 커뮤니티. 그러니까, 정말 좋다는거죠. I'm Canadian. We have members all over the world. If everything fails, ask in the Discord channel and at least a few of our members in your timezone will answer.
Reason을 좋아하지 않나요?
Make sure you talk to us in Discord first, to clear any misunderstanding/misconception! 만약 당신이 여전히 Reason을 싫어한다면, 여기에 대체재가 있어요:
- OCaml. Reason's just a syntax and toolchain layer on top of OCaml. The OCaml<->Reason interop should be seamless since we share the same abstract syntax tree. BuckleScript works fine in OCaml, naturally. Js_of_ocaml too.
- Rust. Close cousin of ours. Not garbage collected, focused on speed & safety.
- Elm. Another cousin of ours! Make clean, fun webapps.
- PureScript. Inspired by Haskell, compiles to the web.
- Fable. Based on F#, which is closely related to OCaml.
- ClojureScript. Nothing in common with us on the surface, but prioritizes simplicity & great interop too.
- Swift. Fruit-flavored OCaml!
Hope that helps! Want to know more? Strike a conversation with any of us in the community!
Reason은 Facebook의 오픈 소스 커뮤니티 프로젝트입니다.