Earlier quoted context omitted.
The short answer is that Reason's syntax is simpler and more enjoyable to use. I simultaneously learned both OCaml and ReasonML syntaxes and find Reason to be much easier to work with. Perhaps people in Reason core will chime in with a more detailed answer. Here's some official information: https://reasonml.github.io/guide/ocaml/
Yeah, I guess the complaint comes from a guy that was already familiar with OCaml's syntax. I guess if you don't know OCaml, maybe the Reason syntax is more appealing.
Type-safe GraphQL with OCaml
21–30 of 102 posts
Re: Type-safe GraphQL with OCaml
#22Earlier quoted context omitted.
The short answer is that Reason's syntax is simpler and more enjoyable to use. I simultaneously learned both OCaml and ReasonML syntaxes and find Reason to be much easier to work with. Perhaps people in Reason core will chime in with a more detailed answer. Here's some official information: https://reasonml.github.io/guide/ocaml/
Yeah, I guess the complaint comes from a guy that was already familiar with OCaml's syntax. I guess if you don't know OCaml, maybe the Reason syntax is more appealing.
The biggest example I can think of is that OCaml uses let..in, which reminds you that every function is a statement. By contrast, the `;` in Reason hides that fact.
That said, it was the Reason syntax that first brought me to the ecosystem, and I think it’s going to be the catalyst that makes OCaml a big player in front end.
Re: Type-safe GraphQL with OCaml
#23If ReasonML is able to form a real community, I have high hopes for its long-term prospects. Such an enjoyable language to use! I think their general approach of bootstrapping a community by lowering impedance with the JS ecosystem is a decent one. In case anyone on the OCaml team is reading this though, there are two language-level changes that I think could do wonders for wider adoption. The first is modular implic…
F# has implicit `+` for basic types (though it’s not quite modular implicits). It also has a really nice syntax for async computations, similar to `async/await`. JS interop is much easier too. It can also run on the server with .NET core if you don’t want to use node.
The output JS is slighter heavier and less optimised than Reason/Bucklescript, and compile times slighter slower, but at the moment those are trade offs I’m happy to make
Re: Type-safe GraphQL with OCaml
#24If ReasonML is able to form a real community, I have high hopes for its long-term prospects. Such an enjoyable language to use! I think their general approach of bootstrapping a community by lowering impedance with the JS ecosystem is a decent one. In case anyone on the OCaml team is reading this though, there are two language-level changes that I think could do wonders for wider adoption. The first is modular implic…
Re: Type-safe GraphQL with OCaml
#25If ReasonML is able to form a real community, I have high hopes for its long-term prospects. Such an enjoyable language to use! I think their general approach of bootstrapping a community by lowering impedance with the JS ecosystem is a decent one. In case anyone on the OCaml team is reading this though, there are two language-level changes that I think could do wonders for wider adoption. The first is modular implic…
I think the exact opposite. Finally a language where floats and integers cannot be mixed together accidentally.
Prelude> (3::Int) + (4::Integer)
:2:13:
Couldn't match expected type ‘Int’ with actual type ‘Integer’
In the second argument of ‘(+)’, namely ‘(4 :: Integer)’
In the expression: (3 :: Int) + (4 :: Integer)
In an equation for ‘it’: it = (3 :: Int) + (4 :: Integer)
It's not by any means the only language with that property either.Re: Type-safe GraphQL with OCaml
#26Earlier quoted context omitted.
Yes, many devs know stuff with C/Java/JavaScript like syntax.
Yeah, for better or worse that's ort of the default. I think ML syntax is fine, and in some cases great. However very few CS programs seem to teach MLs and AFAICT no bootcamps do so these languages tend to get picked up by dedicated autodidacts and academics. ReasonML might be a nice bridge,
Re: Type-safe GraphQL with OCaml
#27If ReasonML is able to form a real community, I have high hopes for its long-term prospects. Such an enjoyable language to use! I think their general approach of bootstrapping a community by lowering impedance with the JS ecosystem is a decent one. In case anyone on the OCaml team is reading this though, there are two language-level changes that I think could do wonders for wider adoption. The first is modular implic…
I think the problem isn't that + +. and ^ look different, it's that they are symbols. That's also what makes scala so unapproachable, you get stuff like ++> or =*= that doesn't make any sense. x + y makes sense to most people x ^ y not so much
Scala is a super approachable language, without any (that I can think of) strange operators in the stdlib. You could make a case for Cats, I guess, but writing purely functional Scala isn't necessary at all, and is something you can approach when or if you feel comfortable to do so.
Re: Type-safe GraphQL with OCaml
#28If you're interested in typed APIs, also check out RESTyped: https://github.com/rawrmaan/restyped It's an end-to-end way to type check REST API calls and responses using TypeScript.
Re: Type-safe GraphQL with OCaml
#29If ReasonML is able to form a real community, I have high hopes for its long-term prospects. Such an enjoyable language to use! I think their general approach of bootstrapping a community by lowering impedance with the JS ecosystem is a decent one. In case anyone on the OCaml team is reading this though, there are two language-level changes that I think could do wonders for wider adoption. The first is modular implic…
You might like to try Fable and F#. I’ve been looking at it since playing with Reason and Bucklescript, and so far I’ve found Fable much easier to use and more featureful. The syntax is essentially the same as OCaml, plus it’s whitespace aware. F# has implicit `+` for basic types (though it’s not quite modular implicits). It also has a really nice syntax for async computations, similar to `async/await`. JS interop is…
Re: Type-safe GraphQL with OCaml
#30I wish OCaml had the libraries and community of Go or Rust, I think it'd be the most useful all-around language out there.
What exactly are you talking about? OCaml has decent libraries for almost everything that you want to do. What exactly are you missing?
Love it as a language, but the ecosystem and community have a ways to go before even slightly widespread adoption.