logoalt Hacker News

jeffrallentoday at 3:00 PM3 repliesview on HN

But probably without any error checking.

Feels like Rust culture inherited "throw and forget" as an error handling "strategy" from Java

Sigh.


Replies

dmittoday at 4:33 PM

Hehe, why "probably"? It says "250 lines" right there in the subject. Surely one can skim the single file of code (https://github.com/ieviev/mini-gzip/blob/main/src/main.rs) and offer criticism that isn't based on hypotheticals?

Anyway, I skimmed the file for you this time, and basically you're either correct or wrong, depending on your definition of "error checking." The code handles error conditions by aborting the process. Seeing as it's a standalone CLI program and not a library meant for reuse, safely shutting down with a meaningful message sounds like fair game to me.

dymktoday at 3:17 PM

This is an educational project. Not something for production. The article even says so!

You can leave the snide comments about “Rust culture” (whatever that is) out next time.

throwaway27448today at 3:19 PM

Why people ascribe error handling practices to languages is baffling. What language doesn't allow punting error handling until later? Even Haskell has "panic" functionality that fudges the type constraints to allow this.

show 1 reply