Hacker News new | ask | show | jobs
by nicoburns 2946 days ago
I used to think that until I tried Rust and found that, without effort, my programs never crashed or had runtime errors. This is possible to achieve in JavaScript, but I do now seriously miss having the compiler do all my safety checks for me!

I still like JS, but I do now appreciate some of the criticisms more.

1 comments

As somebody who writes both JS and Rust: yes, Rust does prevent most runtime errors.

But this isn't without a cost; it's much more expensive to build abstractions in Rust than in JS (although still cheaper than in most languages), for example, and the strictness does create problems with interoperability ergonomics in some places, especially when working with multiple third-party dependencies.

This goes back to my earlier remark about tradeoffs; strictness is not without its costs. The tradeoffs may be worth it to you, or not, or only for some projects - but it means that it makes no sense to paint things like dynamic typing as inherently bad; it just makes different tradeoffs.

I do share your sentiment of missing such 'upfront error-reporting'; that's precisely why I'm working on better tooling for this, of which the variable-renaming is just one aspect :)

I’m not the best programmer but personally I avoid building abstractions as long as possible, deferring until the abstraction is as obvious as possible. The cost then becomes basically irrelevant because the value is so great. Writing JS even with ES6+ is really unpleasant for me. Abstractions or no asbractions, my mental capacity is quite limited compared to a compiler with 2 cores and 8GB of memory.