News for hackers. Stuff that matters.
Re:How I went about learning Rust by brobinson on Friday July 15, 2022 @11:53AM (#32109403)
>Wouldn’t I still have to check for NoScore?

That's right, and the compiler will reject programs where you don't do this. It's a set of safety rails for your code. You pay a dev-/compile-time cost in exchange for your programs not exploding at runtime.

Re:How I went about learning Rust by nailer on Friday July 15, 2022 @02:13PM (#32111158)
Yes but that’s no less work than checking for null in TypeScript. The parent said:

> In your example, you still have to manually check if there's a value every time, but this is not compiler-enforced.

Re:How I went about learning Rust by brobinson on Saturday July 16, 2022 @12:43AM (#32115288)
Sure, it's the same amount of work, but you're forced to do it and the compiler will be able to reject invalid programs. In languages that allow null (including TS, it doesn't 100% enforce the stuff that Haskell, etc. does), you can skip that check, saving some work I suppose, at the risk of your code exploding at runtime. Having stack traces which jump across 50,000 lines of code because someone forgot to check for null somewhere sucks a lot.
Re:How I went about learning Rust by nailer on Sunday July 17, 2022 @01:08PM (#32128691)
TS wouldn’t let you skip that check though.