-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add more motivation to the intro #60
base: main
Are you sure you want to change the base?
Conversation
docs/intro/index.md
Outdated
sync[^1]. In the near future, it will be possible to write [universal React | ||
components](https://github.com/ml-in-barcelona/server-reason-react) that are | ||
performantly rendered on the server using OCaml. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't say "I the near future", it's already possible. It's just not polished. I would explain within the previous sentence: you can write a full-stack application (sharing types, components rendered on the server, etc etc)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about:
If the backend is also written in OCaml,
you can share types between the frontend and backend, ensuring that they stay in
sync[^1]. It's even possible to write universal React
components that are
rendered on the server with the performance of native code[^2].
The [^2] footnote will explain that it's not yet polished.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a better phrasing indeed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rephrased in 8ca7939
docs/intro/index.md
Outdated
All that said, how does OCaml compare against other prominent compile-to-JS | ||
languages? | ||
|
||
**TypeScript** is a gradually-typed superset of JavaScript. It is easier to | ||
learn and adopt, but is less type-safe than OCaml and all other langues on this | ||
list. TypeScript doesn't support pattern matching at the language level. | ||
|
||
**ReScript** is very similar to OCaml, even at the syntax level. Its | ||
RescriptReact library is roughly equivalent to our ReasonReact library. The main | ||
differences are that ReScript's only compilation target is JS, and it lacks the | ||
metaprogramming features of OCaml, so you lose the ability to, say, [embed CSS | ||
styles directly into your code](https://styled-ppx.vercel.app/). | ||
|
||
**Elm** is similar to OCaml but leans much more strongly towards pure functional | ||
programming. It cannot use React but comes with its own framework. It has many | ||
fewer options for JS interop. Even though Elm compiles to JS, it can't be used | ||
for backend development, even on Node. | ||
|
||
This is a project-based, guided introduction to Melange and its ecosystem. | ||
**F#** is a fullstack language similar to OCaml and is strongly aligned with the | ||
.NET ecosystem. F# has good support for functional programming and zero-cost | ||
interop with C#. Feliz is an F# wrapper library for React that doesn't support | ||
JSX. | ||
|
||
**Kotlin** is a type-safe fullstack language strongly associated with the | ||
Compose Multiplatform UI framework. Kotlin-react is a Kotlin wrapper library for | ||
React which doesn't support JSX. Kotlin has some features in common with OCaml, | ||
but doesn't have pattern matching. | ||
|
||
**Dart** is a type-safe fullstack language strongly associated with the Flutter | ||
UI framework, which supports compiling UI apps to mobile, desktop, and browser | ||
environments. There's no Dart wrapper library for modern, functional React | ||
components. | ||
|
||
**OCaml** has another JS transpiler called js_of_ocaml. Unlike Melange, | ||
js_of_ocaml prioritizes OCaml compatibility over JavaScript interop. | ||
|
||
As you can see, each compile-to-JS language has its own design goals, which | ||
dictate its strengths and weaknesses relative to OCaml and Melange. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would move this into a separate section or even in the melange documentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The language comparison section was added in response to #58 and also another reader who responded to me via DM. But I agree it makes sense to add it to Melange docs as well.
that translates OCaml to human-readable JavaScript and built-in language | ||
constructs for zero-cost interoperation with JavaScript. | ||
|
||
## Why OCaml? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same discussion as ever, but "Why OCaml?" when you will write the book in reason is strange, confusing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to me that most of the benefits of Melange come from OCaml, and the book does teach OCaml (using Reason syntax).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh wait, do you mean Melange in the sense of the subset of OCaml language supported by Melange?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To add my 2 cents: It might be beneficial to just add a quick note that communicates that:
Ocaml = general purpose programming language developed in the 90s (and from my understanding, derived from ML
ReasonML = a set of Ocaml extensions/different way of writing OCaml (this is my understanding as someone with lots of functional JavaScript experience, but not a whole lot of ML experience)
Also note that while we are talking about Ocaml here, the reader can expect to see a lot more ReasonML later.
that translates OCaml to human-readable JavaScript and built-in language | ||
constructs for zero-cost interoperation with JavaScript. | ||
|
||
## Why OCaml? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to me that most of the benefits of Melange come from OCaml, and the book does teach OCaml (using Reason syntax).
docs/intro/index.md
Outdated
sync[^1]. In the near future, it will be possible to write [universal React | ||
components](https://github.com/ml-in-barcelona/server-reason-react) that are | ||
performantly rendered on the server using OCaml. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about:
If the backend is also written in OCaml,
you can share types between the frontend and backend, ensuring that they stay in
sync[^1]. It's even possible to write universal React
components that are
rendered on the server with the performance of native code[^2].
The [^2] footnote will explain that it's not yet polished.
|
||
**OCaml** has another JS transpiler called js_of_ocaml. Unlike Melange, | ||
js_of_ocaml prioritizes OCaml compatibility over JavaScript interop. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Originally I had one paragraph for Rust here, but not sure if it's really in the same space as it compiles to WebAssembly and not normal JS. Should I bring it back?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is a comparison to Gleam worthwhile?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And PureScript since it was mentioned in the issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docs/intro/index.md
Outdated
All that said, how does OCaml compare against other prominent compile-to-JS | ||
languages? | ||
|
||
**TypeScript** is a gradually-typed superset of JavaScript. It is easier to | ||
learn and adopt, but is less type-safe than OCaml and all other langues on this | ||
list. TypeScript doesn't support pattern matching at the language level. | ||
|
||
**ReScript** is very similar to OCaml, even at the syntax level. Its | ||
RescriptReact library is roughly equivalent to our ReasonReact library. The main | ||
differences are that ReScript's only compilation target is JS, and it lacks the | ||
metaprogramming features of OCaml, so you lose the ability to, say, [embed CSS | ||
styles directly into your code](https://styled-ppx.vercel.app/). | ||
|
||
**Elm** is similar to OCaml but leans much more strongly towards pure functional | ||
programming. It cannot use React but comes with its own framework. It has many | ||
fewer options for JS interop. Even though Elm compiles to JS, it can't be used | ||
for backend development, even on Node. | ||
|
||
This is a project-based, guided introduction to Melange and its ecosystem. | ||
**F#** is a fullstack language similar to OCaml and is strongly aligned with the | ||
.NET ecosystem. F# has good support for functional programming and zero-cost | ||
interop with C#. Feliz is an F# wrapper library for React that doesn't support | ||
JSX. | ||
|
||
**Kotlin** is a type-safe fullstack language strongly associated with the | ||
Compose Multiplatform UI framework. Kotlin-react is a Kotlin wrapper library for | ||
React which doesn't support JSX. Kotlin has some features in common with OCaml, | ||
but doesn't have pattern matching. | ||
|
||
**Dart** is a type-safe fullstack language strongly associated with the Flutter | ||
UI framework, which supports compiling UI apps to mobile, desktop, and browser | ||
environments. There's no Dart wrapper library for modern, functional React | ||
components. | ||
|
||
**OCaml** has another JS transpiler called js_of_ocaml. Unlike Melange, | ||
js_of_ocaml prioritizes OCaml compatibility over JavaScript interop. | ||
|
||
As you can see, each compile-to-JS language has its own design goals, which | ||
dictate its strengths and weaknesses relative to OCaml and Melange. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The language comparison section was added in response to #58 and also another reader who responded to me via DM. But I agree it makes sense to add it to Melange docs as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's looking great.
A note on the comparison section, it might sound a bit defensive, maybe some wording like usages of "but" ("TS is easier, but...", "Elm is similar, but..."), and also some extended usage of adjectives that can be vague ("much more strongly", "many fewer options"...) contribute to that?
Maybe this section should show alternatives and why one would pick them up (rather than focusing on what they're missing).
If the goal is to show what things they're missing (pattern matching, React integration, zero cost bindings, JSX) it might be better to create a table instead.
docs/intro/index.md
Outdated
|
||
OCaml codebases scale well both in terms of quantity of lines and number of | ||
contributors. The sound type system helps to prevent ambiguous behavior in your | ||
program---if it compiles, it runs. OCaml and React (via |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "if it compiles, it runs" is a bit confusing because TypeScript also "runs if it compiles" 😄 What about
program---if it compiles, it runs. OCaml and React (via | |
program---if it compiles, it runs without runtime errors. OCaml and React (via |
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 8ca7939
docs/intro/index.md
Outdated
languages? | ||
|
||
**TypeScript** is a gradually-typed superset of JavaScript. It is easier to | ||
learn and adopt, but is less type-safe than OCaml and all other langues on this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
learn and adopt, but is less type-safe than OCaml and all other langues on this | |
learn and adopt, but is less type-safe than OCaml and all other languages on this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in #60
docs/intro/index.md
Outdated
**ReScript** is very similar to OCaml, even at the syntax level. Its | ||
RescriptReact library is roughly equivalent to our ReasonReact library. The main |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
**ReScript** is very similar to OCaml, even at the syntax level. Its | |
RescriptReact library is roughly equivalent to our ReasonReact library. The main | |
**ReScript** is very similar to OCaml, even at the syntax level. Its | |
rescript-react bindings are roughly equivalent to Melange reason-react bindings. The main |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed in #60
docs/intro/index.md
Outdated
metaprogramming features of OCaml, so you lose the ability to, say, [embed CSS | ||
styles directly into your code](https://styled-ppx.vercel.app/). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Styled-ppx supports ReScript, so I would rather mention the ability to write universal components as the main benefit or Melange + ReasonReact.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deleted metaprogramming mention in #60
docs/intro/index.md
Outdated
environments. There's no Dart wrapper library for modern, functional React | ||
components. | ||
|
||
**OCaml** has another JS transpiler called js_of_ocaml. Unlike Melange, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's the Melange for X developers page that has a jsoo section, not sure if worth mentioning.
Also includes subsections about ReScript and TypeScript.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docs/intro/index.md
Outdated
components. | ||
|
||
**OCaml** has another JS transpiler called js_of_ocaml. Unlike Melange, | ||
js_of_ocaml prioritizes OCaml compatibility over JavaScript interop. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd also mention that the story to use React is much more stable and tested in Melange than in jsoo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add this detail in d36abdf
docs/intro/index.md
Outdated
metaprogramming features of OCaml, so you lose the ability to, say, [embed CSS | ||
styles directly into your code](https://styled-ppx.vercel.app/). | ||
|
||
**Elm** is similar to OCaml but leans much more strongly towards pure functional |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
**Elm** is similar to OCaml but leans much more strongly towards pure functional | |
**Elm** is similar to OCaml. It leans strongly towards pure functional |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed in #60
docs/intro/index.md
Outdated
programming. It cannot use React but comes with its own framework. It has many | ||
fewer options for JS interop. Even though Elm compiles to JS, it can't be used | ||
for backend development, even on Node. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
programming. It cannot use React but comes with its own framework. It has many | |
fewer options for JS interop. Even though Elm compiles to JS, it can't be used | |
for backend development, even on Node. | |
programming. It has fewer options for JS interop and cannot use React but comes with | |
its own framework. Elm can't be used for backend development, even on Node. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"It cannot use React but comes with its own framework".
It's more like: "Elm treats JavaScript as unsafe, with possibility to interact with it via ports. Integrations like React or Melange FFI aren't possible"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed in #60
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
never understood how lamdera or elm-pages run in the backend. I asked a few times here and there and didn't get a decent answer. Just offtopic, but always curious
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@psb I perused lamdera and elm-page sites but couldn't get a clear idea of how they work at all, so I'm hesitant to include it in the comparison
docs/intro/index.md
Outdated
**TypeScript** is a gradually-typed superset of JavaScript. It is easier to | ||
learn and adopt, but is less type-safe than OCaml and all other langues on this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would try to be more expressive on comparing with TypeScript.
TypeScript is a gradually-typed superset of JavaScript. It's easier to
learn and adopt. His design, following closely JavaScript, brings a few footguns, like any, "as" casting, and ts-nocheck (to say a few) becoming less type-safe than OCaml.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added in #60
@psb What do you think? |
.NET ecosystem. F# has good support for functional programming and zero-cost | ||
interop with C#. Feliz is an F# wrapper library for React that doesn't support | ||
JSX. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can use jsx in Fable/Feliz: https://fable.io/blog/2022/2022-10-12-react-jsx.html , it's just that most people use the elm like syntax.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took a look at JSX in Fable/Feliz, but the usage doesn't seem ergonomic to me (implemented using string templates). Probably just my opinion, but I don't think it qualifies as "JSX".
I think you might have to go deeper in comparing it to TypeScript. When you watch a video of someone doing TS or React in TS it is easy to think that TS is good enough or type safe enough, so I don't think words are going to convince someone to switch, especially since using Melange is not a trivial matter - someone has to learn Reason/OCaml, dune, melange, interop, and maybe even functional programming for the first time. I think code comparisons and concrete examples will be more convincing reasons to switch, e.g.,:
Some of this may overlap with Reason docs but I think that is okay. You really have to make someone think 'wow!' and really want to explore it further; otherwise, it will seem that TS is just good enough. Testimonials from production users can also go a long way in convincing people to try it out. This might have to it's own section if you think it is worth doing. |
All that said, how does OCaml compare against other prominent compile-to-JS | ||
languages? | ||
|
||
**TypeScript** is a gradually-typed superset of JavaScript. It's easier to learn | ||
and adopt because its design highly emphasizes compatibility with JavaScript. | ||
This brings a few footguns, such as `any`, `as` casting, `ts-nocheck` etc, | ||
making it less type-safe than OCaml (and all the other languages on this list)[^3]. | ||
|
||
- Zero-cost JS interop? Yes | ||
- Can use with React? Yes | ||
- Supports JSX? Yes | ||
- Pattern matching? No | ||
- Can use on server? Yes, via Node. | ||
|
||
**ReScript** is very similar to OCaml, even at the syntax level. The main | ||
difference is that ReScript's only compilation target is JS[^4]. | ||
|
||
- Zero-cost JS interop? Yes | ||
- Can use with React? Yes, via [@rescript/react](https://github.com/rescript-lang/rescript-react), which is roughly equivalent to | ||
Melange's ReasonReact bindings. | ||
- Supports JSX? Yes | ||
- Pattern matching? Yes | ||
- Can use on server? Yes, via Node. | ||
|
||
**Elm** is similar to OCaml. It leans strongly towards pure functional | ||
programming. | ||
|
||
- Zero-cost JS interop? No. Elm treats JavaScript as unsafe, interacting with JS | ||
via ports (more like message passing than traditional FFI). Ergonomic | ||
integration with React and other libraries isn't possible. | ||
- Can use with React? No. Elm has its own framework with some similar concepts. | ||
- Supports JSX? No | ||
- Pattern matching? Yes | ||
- Can use on server? No | ||
|
||
**F#** is a fullstack language similar to OCaml and is strongly aligned with the | ||
.NET ecosystem. | ||
|
||
- Zero-cost JS interop? Probably | ||
- Can use with React? Yes. [Feliz](https://github.com/Zaid-Ajaj/Feliz) is an F# | ||
wrapper library for React. | ||
- Supports JSX? No. Feliz uses ordinary function call syntax for render logic. | ||
- Pattern matching? Yes | ||
- Can use on server? Yes, via .NET or Node. | ||
|
||
**Gleam** is a fullstack language similar to OCaml which is aligned with the | ||
BEAM ecosystem. | ||
|
||
- Zero-cost JS interop? No, but Gleam's JS compilation target is relatively new, | ||
so it may become more optimized in the future. | ||
- Can use with React? Yes, via [redraw](https://github.com/ghivert/redraw) and [react-gleam](https://github.com/brettkolodny/react-gleam). | ||
- Supports JSX? No | ||
- Pattern matching? Yes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see the point of this section, this is a book of Reason and Melange.
Let's encourage people to read about comparisons in the melange documentation or a blog post.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd kind of lean this way too. It reads a bit like a sales pitch. Maybe at a minimum, cut down on a few of the alternatives.
Correct + Efficient + Beautiful](https://cs3110.github.io/textbook/), which | ||
teaches the language from the ground up and goes much deeper into its features. | ||
[ReasonReact][reasonreact]. You do not need to know OCaml[^6]---we'll slowly | ||
introduce the basics of the language throughout the tutorial. That said, a good |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably the audience is a bit "informed" about FP
I think the scope of the book is to teach the reader how to use Melange. Motivating them to do so should be the work of blog posts, conference talks, testimonials, i.e. the work of the wider community. |
that translates OCaml to human-readable JavaScript and built-in language | ||
constructs for zero-cost interoperation with JavaScript. | ||
|
||
## Why OCaml? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To add my 2 cents: It might be beneficial to just add a quick note that communicates that:
Ocaml = general purpose programming language developed in the 90s (and from my understanding, derived from ML
ReasonML = a set of Ocaml extensions/different way of writing OCaml (this is my understanding as someone with lots of functional JavaScript experience, but not a whole lot of ML experience)
Also note that while we are talking about Ocaml here, the reader can expect to see a lot more ReasonML later.
OCaml codebases scale well both in terms of quantity of lines and number of | ||
contributors. The sound type system helps to prevent ambiguous behavior in your | ||
program---if it compiles, it runs without runtime errors. OCaml and React (via | ||
[ReasonReact][reasonreact]) are an effective, FP-friendly combination for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A quick note on how ReasonReact relates to OCaml/ReasonML - it's not clear to me. May not be important at this point, but just a thought.
This brings a few footguns, such as `any`, `as` casting, `ts-nocheck` etc, | ||
making it less type-safe than OCaml (and all the other languages on this list)[^3]. | ||
|
||
- Zero-cost JS interop? Yes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe for each of these lists, a quick "Pros and Cons"
All that said, how does OCaml compare against other prominent compile-to-JS | ||
languages? | ||
|
||
**TypeScript** is a gradually-typed superset of JavaScript. It's easier to learn | ||
and adopt because its design highly emphasizes compatibility with JavaScript. | ||
This brings a few footguns, such as `any`, `as` casting, `ts-nocheck` etc, | ||
making it less type-safe than OCaml (and all the other languages on this list)[^3]. | ||
|
||
- Zero-cost JS interop? Yes | ||
- Can use with React? Yes | ||
- Supports JSX? Yes | ||
- Pattern matching? No | ||
- Can use on server? Yes, via Node. | ||
|
||
**ReScript** is very similar to OCaml, even at the syntax level. The main | ||
difference is that ReScript's only compilation target is JS[^4]. | ||
|
||
- Zero-cost JS interop? Yes | ||
- Can use with React? Yes, via [@rescript/react](https://github.com/rescript-lang/rescript-react), which is roughly equivalent to | ||
Melange's ReasonReact bindings. | ||
- Supports JSX? Yes | ||
- Pattern matching? Yes | ||
- Can use on server? Yes, via Node. | ||
|
||
**Elm** is similar to OCaml. It leans strongly towards pure functional | ||
programming. | ||
|
||
- Zero-cost JS interop? No. Elm treats JavaScript as unsafe, interacting with JS | ||
via ports (more like message passing than traditional FFI). Ergonomic | ||
integration with React and other libraries isn't possible. | ||
- Can use with React? No. Elm has its own framework with some similar concepts. | ||
- Supports JSX? No | ||
- Pattern matching? Yes | ||
- Can use on server? No | ||
|
||
**F#** is a fullstack language similar to OCaml and is strongly aligned with the | ||
.NET ecosystem. | ||
|
||
- Zero-cost JS interop? Probably | ||
- Can use with React? Yes. [Feliz](https://github.com/Zaid-Ajaj/Feliz) is an F# | ||
wrapper library for React. | ||
- Supports JSX? No. Feliz uses ordinary function call syntax for render logic. | ||
- Pattern matching? Yes | ||
- Can use on server? Yes, via .NET or Node. | ||
|
||
**Gleam** is a fullstack language similar to OCaml which is aligned with the | ||
BEAM ecosystem. | ||
|
||
- Zero-cost JS interop? No, but Gleam's JS compilation target is relatively new, | ||
so it may become more optimized in the future. | ||
- Can use with React? Yes, via [redraw](https://github.com/ghivert/redraw) and [react-gleam](https://github.com/brettkolodny/react-gleam). | ||
- Supports JSX? No | ||
- Pattern matching? Yes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd kind of lean this way too. It reads a bit like a sales pitch. Maybe at a minimum, cut down on a few of the alternatives.
introduce the basics of the language throughout the tutorial. That said, a good | ||
complement to this guide is [OCaml Programming: Correct + Efficient + | ||
Beautiful](https://cs3110.github.io/textbook/), which teaches the language from | ||
the ground up and goes much deeper into its features. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like the external resources for further reading!
Addresses #58