Live data from Hacker News

Ergonomic errors in Rust: write fast, debug with ease, handle precisely

gmcgoldr.github.io

21–28 of 28 posts

Re: Ergonomic errors in Rust: write fast, debug with ease, handle precisely

#21

Earlier quoted context omitted.

LLMs love to do this. I assume they are trying to write JavaScript or Python or whatever, but in Rust. I have never seen an actual Rist programmer do this, and that was clue #1 that TFA was AI generated without review.

I do when prototyping. Long term you don't really want to pass around &str errors, but they are quick and dirty and easy to get rolling with.

Seems just as quick to make an enum with thiserror string conversion? Not much boilerplate at least.

Re: Ergonomic errors in Rust: write fast, debug with ease, handle precisely

#22
post #9

Earlier quoted context omitted.

Compilation time turns into cognitive load via frustration. Death by a thousand cuts.

https://xkcd.com/303/ (compilation time is good for brain switch off time - i.e. reducing cognitive load).

I find it's great for letting ADHD take over steering the ship and losing total focus on what needs to be done.

Which is more or less what this XKCD encapsulates.

Re: Ergonomic errors in Rust: write fast, debug with ease, handle precisely

#23
post #4

This just feels like recreating exceptions, but with more complicated syntax.

I mean broadly that's my entire problem with errors as values: every implementation wastes a ton of syntax trying to make them like exceptions.

Go unironically gets this right - you just treat them like a normal value instead of trying to make them more "ergonomic".

Re: Ergonomic errors in Rust: write fast, debug with ease, handle precisely

#24

Earlier quoted context omitted.

LLMs love to do this. I assume they are trying to write JavaScript or Python or whatever, but in Rust. I have never seen an actual Rist programmer do this, and that was clue #1 that TFA was AI generated without review.

I do when prototyping. Long term you don't really want to pass around &str errors, but they are quick and dirty and easy to get rolling with.

You can also use eyre! with it's accompanying Result for even easier and faster development.

Re: Ergonomic errors in Rust: write fast, debug with ease, handle precisely

#25

This just feels like recreating exceptions, but with more complicated syntax.

Yeah but only if you were to always use checked exceptions, and have mandatory try/catch around every function call, and have a much nicer syntax for throwing exceptions with added context. I've never seen any language that did that but I guess it would be possible.

Re: Ergonomic errors in Rust: write fast, debug with ease, handle precisely

#26

I have never seen anything use Result , that is such an anti-rust thing to start with.

LLMs love to do this. I assume they are trying to write JavaScript or Python or whatever, but in Rust. I have never seen an actual Rist programmer do this, and that was clue #1 that TFA was AI generated without review.

I’m an actual Rust programmer, and I’ve done that. Especially for the first iteration of something when I’m not yet sure what will be included, or when the errors are just going to be printed to the terminal as the program exits.

Re: Ergonomic errors in Rust: write fast, debug with ease, handle precisely

#27

Rust used to be pretty hard to read and write, now with ai coding agent not anymore.

Have you had success doing non-trivial Rust with AI agents? In my experience they're all pretty bad at it once you get beyond the basics and start having tricky lifetimes and complicated types, but I'm interested to hear what people have done to make it better.

yes i did, try aistudio > gemini pro 2.5 from web console on your programm lemme know how well it works.

Re: Ergonomic errors in Rust: write fast, debug with ease, handle precisely

#28
>And errors are consumed by two distinct consumers with different needs: the developer debugging an application, and the caller making error handling decisions at runtime.

Three. Three distinct consumers. Get that in your head. When your application errors out on startup, it's the user who sees the error message. File system errors without seeing the path of the file are useless.

Post reply on HN