Skip to content

Documentation update (mentions Melange and fixes a few things) #765

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 37 commits into from
Nov 3, 2023
Merged
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
fe63894
Add a getting-started page
davesnx Sep 3, 2023
5081bd7
Improve installation
davesnx Sep 3, 2023
f67528f
Push jsoo into it's own page
davesnx Sep 3, 2023
092e5f8
Setup compiling to js melange page
davesnx Sep 3, 2023
035f7e4
Improve what and why
davesnx Sep 3, 2023
6a59a1e
Setup sidebar
davesnx Sep 3, 2023
b085af2
Merge branch 'source' of github.com:/reasonml/reasonml.github.io into…
davesnx Sep 3, 2023
8ef94bc
Fix getting started
davesnx Sep 11, 2023
b1c2b1d
Annotate compile to js *with melange*
davesnx Sep 11, 2023
9716a91
Fix localized-strings
davesnx Oct 17, 2023
ef31d26
Add installation stuff
davesnx Oct 17, 2023
f36461d
Merge pull request #1 from davesnx/Improve-documentation-and-add-melange
davesnx Oct 17, 2023
32993f0
Fix localized-strings safety
davesnx Oct 17, 2023
c14dec8
Installation + what + started
davesnx Oct 19, 2023
3055bc0
Rename Reason
davesnx Oct 23, 2023
a1f5a93
Develop better installation
davesnx Oct 23, 2023
abcf79d
Recommend the melange template to install
davesnx Oct 23, 2023
83e2014
Simplify started
davesnx Oct 23, 2023
7eb0d06
Explain a small environtments intro
davesnx Oct 23, 2023
b07ce5d
Remove system req
davesnx Oct 23, 2023
7c7aa7d
Setup melange page
davesnx Oct 24, 2023
842e85d
Minimse jsoo
davesnx Oct 24, 2023
3cfb9f4
Make editor clear relation with ocaml platform
davesnx Oct 24, 2023
b10dd13
Specify switch
davesnx Oct 24, 2023
7b0f53b
Better compile to js w melange
davesnx Oct 24, 2023
7b228ed
Bring stuff from the past back
davesnx Oct 24, 2023
94588e1
Add note from reason-react
davesnx Oct 24, 2023
3bca4d9
Mention Melange on the homepage
davesnx Oct 24, 2023
486752b
Remove esy cache
davesnx Oct 24, 2023
faed3bc
Explain JSX better
davesnx Oct 24, 2023
4b4d81d
Add refmt and rtop
davesnx Oct 24, 2023
feaa16b
Polish usage
davesnx Oct 24, 2023
d1fe924
Use bash everywhere
davesnx Oct 24, 2023
c8e1896
Add title
davesnx Oct 25, 2023
3032546
Fix pattern matching snippets
davesnx Nov 3, 2023
b260631
Update docs/compiling-to-js-with-melange.md
davesnx Nov 3, 2023
03cada3
Update docs/compiling-to-js-with-melange.md
davesnx Nov 3, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Explain a small environtments intro
  • Loading branch information
davesnx committed Oct 23, 2023
commit 7eb0d06714b8d8055cd5a0e1e3d8852563b62102
13 changes: 8 additions & 5 deletions docs/what-and-why.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,15 @@ Reason can be compiled to native, bytecode, and JavaScript, with an ongoing plan

## Different Environments

There are several projects that allow Reason (and OCaml) to be used in different environments.
Reason compiles to JavaScript thanks to our partner project, [Melange](https://melange.re), which compiles OCaml/Reason into JavaScript with smooth interoperability with JavaScript. Reason also compiles to fast, barebone assembly, thanks to OCaml itself.

- **JavaScript**: Compile Reason to equivalent JavaScript code that can be run in the browser, or any other JavaScript environment.
- [Melange](https://melange.re) is a backend for the OCaml compiler that emits JavaScript. Melange strives to provide the best integration with both the OCaml and JavaScript ecosystems. It is the recommended way to compile Reason to JavaScript, since it compiles 1 module to 1 file, has a very good interop with JavaScript and integrates well with modern frontend development tooling.
- [Js_of_ocaml](https://ocsigen.org/js_of_ocaml) is a compiler from OCaml bytecode programs to JavaScript. Since it compiles from the bytecode, it can compile all OCaml programs, but makes the whole process more opaque, generates bigger bundles and has a worse interop with JavaScript.
- **Native**: Using the OCaml compiler to produce native executables that can run directly on your machine. [dune](https://dune.build) is the defacto build system for native OCaml projects, but it's also possible to use [ocamlc (OCaml's compiler)](https://ocaml.org/docs/compiling-ocaml-projects) directly
There's a clear distinction between the two environments, one runs JavaScript in the browser while the other runs assembly on the machine. But the language constructors and tooling is the same, so you can write code for the two environments.

**Compile to JavaScript**
[Melange](https://melange.re) is a backend for the OCaml compiler that emits JavaScript. Melange strives to provide the best integration with both the OCaml and JavaScript ecosystems. It is the recommended way to compile Reason to JavaScript, since it compiles 1 module to 1 file, has a very good interop with JavaScript and integrates well with modern frontend development tooling.

**Compile to Native**
Using the OCaml compiler to produce native executables that can run directly on your machine. It's recommended to use [dune](https://dune.build) which is the defacto build system for native OCaml projects, but it's also possible to use [ocamlc (OCaml's compiler)](https://ocaml.org/docs/compiling-ocaml-projects) directly.

## Where do I start?

Expand Down