News for hackers. Stuff that matters.
Re:Ask HN: Programs that saved you 100 hours? (2022 edition) by hedora on Tuesday December 20, 2022 @01:59PM (#34070597)
You should check out rust. The compiler reasons about side effects + parallelization, and testing for you, but you get (nearly) complete low-level control.

As a bonus, you'll be able to write insufferable comments like these in HN threads.

Re:Ask HN: Programs that saved you 100 hours? (2022 edition) by Quekid5 on Tuesday December 20, 2022 @03:00PM (#34071632)
Not to put too fine a point on it, but "side effects" != mutation.

Also: The level of control offered by Rust comes at a steep cost compared to GC'd languages.

Re:Ask HN: Programs that saved you 100 hours? (2022 edition) by adamzen on Wednesday December 21, 2022 @06:03AM (#34079094)
I am relatively new to rust, but motivated to learn it right now. Could you elaborate on what the cost compared to garbage collected languages is?
Re:Ask HN: Programs that saved you 100 hours? (2022 edition) by actinium226 on Thursday December 22, 2022 @08:55PM (#34101478)
I think he means two things, mind you I'm not very familiar with Rust, but I've done a lot of safety-critical C/C++, which is sort of like Rust

1. There's a mental cost on the programmer. You have to learn all the ins and outs of things like the "borrow checker" (a Rust concept) and it's on you to understand the rules and how to use them

2. It can slow down compile time. As your program gets bigger, the compiler is doing more work to check that it's valid code, so that will slow you down.

Re:Ask HN: Programs that saved you 100 hours? (2022 edition) by Quekid5 on Friday December 23, 2022 @01:52PM (#34109328)
I was mostly thinking of the #1 mentioned by actinium226 in a sibling post, fwiw.

The main other thing I was thinking of was that GC languages sometimes have features that are very hard to support sensibly in non-GC languages: My favorite example is the higher-kinded types (HKT) which e.g. Scala and Haskell support. These can incidentally be used to "tame" side effects in a very principled way (via Monads). Another example would be lazy computation/values.

(Other applications of HKTs are validation integrated with parsing while still providing the maximum actionable feedback to users.)