Live data from Hacker News

I Switched from TypeScript to ReScript

medium.com

11–20 of 49 posts

Re: I Switched from TypeScript to ReScript

#11
post #7
post #6

> ReScript is not just a rebranding: it’s a ReasonML which freed itself of the yoke of the OCaml ecosystem. By doing so, it forfeited compilation to native code and OCaml library interop, but gained a freer syntax which further resembles JavaScript See also BuckleScript & Reason are now called ReScript : https://rescript-lang.org/bucklescript-rebranding

Here's a great comment explaining all the permutations: https://news.ycombinator.com/item?id=25426438 At least from a branding perspective, it seems the whole thing has been quite bungled. But obviously what's more relevant is how well the technical goals actually get met.

Generally speaking, I am pretty happy with the (small) syntax changes from Reason to Rescript [1]. No necessary semi-colon, arrays, object declaration & access. We can finally pattern match on arrays [2] which I think was not possible with Reason (only lists were).

However, there are no custom infix operator with Rescript [1], which is quite sad as it makes monadic code cleaner, whereas they were supported by ReasonML.

[1] https://rescript-lang.org/docs/manual/latest/migrate-from-bu... [2] https://rescript-lang.org/docs/manual/latest/pattern-matchin...

Re: I Switched from TypeScript to ReScript

#12
post #5

Why not simply use Javascript? Today it's a fine language. You may complain about fatigue etc which I can buy, but Rescript is simply not solving that.

the only reason I'm using typescript over javascript is types, once I converted a huge code base, there were instances where I fed javascript wrong number of args, or just wrong type of args and it did work (failing subtly on runtime), otherwise is perfectly fine.

I also like it for not having to constantly check properties before using them. I parse the data once at the application boundary (like after an API call) and then I can use it with confidence.

Re: I Switched from TypeScript to ReScript

#14
post #7
post #6

> ReScript is not just a rebranding: it’s a ReasonML which freed itself of the yoke of the OCaml ecosystem. By doing so, it forfeited compilation to native code and OCaml library interop, but gained a freer syntax which further resembles JavaScript See also BuckleScript & Reason are now called ReScript : https://rescript-lang.org/bucklescript-rebranding

Here's a great comment explaining all the permutations: https://news.ycombinator.com/item?id=25426438 At least from a branding perspective, it seems the whole thing has been quite bungled. But obviously what's more relevant is how well the technical goals actually get met.

A couple of years ago I was a big advocate of ReasonML and went so far as to run a meet up. I honestly believed in the technical value of it and saw it as a better alternative to Typescript.

At the time, the waters were muddy enough with Reason, Bucklescript and OCaml but you could explain it away. The rebrand and change of syntax that came with Rescript was the end of the line for me. Issues like async await have gone unaddressed for years and instead the community is caught up on syntaxes and compilation targets.

I turned to Clojurescript since. It solved most of it's problems years ago and its functional enough that I don't miss the static types. The large standard library also avoids the questions around whether you should use Belt or Tablecloth or any of the other "standard" libraries.

Re: I Switched from TypeScript to ReScript

#15
post #7

Earlier quoted context omitted.

Here's a great comment explaining all the permutations: https://news.ycombinator.com/item?id=25426438 At least from a branding perspective, it seems the whole thing has been quite bungled. But obviously what's more relevant is how well the technical goals actually get met.

A couple of years ago I was a big advocate of ReasonML and went so far as to run a meet up. I honestly believed in the technical value of it and saw it as a better alternative to Typescript. At the time, the waters were muddy enough with Reason, Bucklescript and OCaml but you could explain it away. The rebrand and change of syntax that came with Rescript was the end of the line for me. Issues like async await have go…

Tablecloth uses Belt for JS targets

Re: I Switched from TypeScript to ReScript

#16

> Simply renaming the file extension won’t work, as the compiler stops completely at type errors. Why did the author think that this would work exactly?

It works in TypeScript - just rename something from JS to TS and the you have the benefits of TS's types, warnings, and features but your code will continue to work. Untyped things default to 'any', which is useful if you want to migrate a project from JS to TS. It's a very useful feature if you have a mature project in JS that you want to improve.

Re: I Switched from TypeScript to ReScript

#17
post #5

Why not simply use Javascript? Today it's a fine language. You may complain about fatigue etc which I can buy, but Rescript is simply not solving that.

the only reason I'm using typescript over javascript is types, once I converted a huge code base, there were instances where I fed javascript wrong number of args, or just wrong type of args and it did work (failing subtly on runtime), otherwise is perfectly fine.

Ok well that is true and may happen sometimes. Personally, I have just dabbled with type definitions, configs etc much more than I ever had those kinds of problems in javascript.

I just feel typescript usually gets in the way, sometimes in a good way, but all too often in a bad way.

Plus my main gripe with typescript is that microsoft owns and controls it so I won't use it just because of that.

Re: I Switched from TypeScript to ReScript

#18

Why not simply use Javascript? Today it's a fine language. You may complain about fatigue etc which I can buy, but Rescript is simply not solving that.

Because of static types. If you're building software that needs to be maintained over time, types are always preferable to a lack of types. This is because types codify the shape of application data structures that exist whether you explicitly define them or not. A lack of types is a form of technical debt that every future developer has to repay as they discover application data structures through trial and error.

Re: I Switched from TypeScript to ReScript

#19

I think the best point in the article is this: > ReScript, as with other statically typed functional languages, aims at changing the way code is approached at a fundamental level. We currently have a project written in ReScript and it's an absolute nightmare. Most of our stack is JavaScript/TypeScript/Flow, so no one can just jump in and work on it very easily - they first have to learn ReScript and all of it's diffe…

It's a common challenge with any kind of software; as a company, you want to avoid adding more to your stack, even if it means using a suboptimal or boring technology. Every new technology adds complexity and difficulty. Actually I'll just link it, it explains the concept much better (and with pictures!) than I can: http://boringtechnology.club/

Re: I Switched from TypeScript to ReScript

#20
post #4

I was using TypeScript all through 2019. Went back to plain old JavaScript at the beginning of 2020. Still using plain old JavaScript by default, and break out React when I _really_ have to. No regrets, many benefits.

typescript is liteally a superset of js. what are your benefits

The biggest practical benefits of plain JS over TS are that:

* code is terser

* the JS standard is more stable/standardised

* code can be distributed uncompiled

* code has broader tooling support

* code can be reasoned about and debugged directly and natively in web browsers without the need for sourcemaps/plugins/etc.

* file sizes are generally smaller

* there are fewer config files

* there are fewer moving parts and therefore fewer sources of error

* there are fewer levels of abstraction and therefore fewer sources of error

* etc.

(TS diehards will argue that typing ameliorates higher error rates)

Post reply on HN