News for hackers. Stuff that matters.
Re:Using Rust at a Startup: A Cautionary Tale by kazinator on Wednesday November 23, 2022 @12:58AM (#33715743)
> I can depend on the compiler telling me if I haven't done so exhaustively, via the Result type

That's going to get tiresome after about half a day.

Exceptions or GTFO.

Re:Using Rust at a Startup: A Cautionary Tale by 3a2d29 on Wednesday November 23, 2022 @01:38AM (#33715947)
I will die on the hill that Exceptions are absolutely terrible for readability and control flow and should die.

Result<> or Go returning many values is wayyyy better.

Re:Using Rust at a Startup: A Cautionary Tale by kazinator on Wednesday November 23, 2022 @01:59AM (#33716047)
I will bury you and then unwind your stack, and clean up everything.
Re:Using Rust at a Startup: A Cautionary Tale by kazinator on Wednesday November 23, 2022 @10:45AM (#33720607)
I'm so convinced that there exceptions are the superior article, that basically there is no hill worth dying on that can even be identified. It would be like saying that I'm going to personally defend a civilized continent against some fringe bushmen armed with flint arrowheads. I've got an army for that, funded by my taxes.
Re:Using Rust at a Startup: A Cautionary Tale by nine_k on Wednesday November 23, 2022 @01:11AM (#33715815)
If you think Result is not ergonomic enough, try writing some Go.

In fact, you can often return Result from an underlying function from your own, achieving an effect similar to exceptions.

Re:Using Rust at a Startup: A Cautionary Tale by satvikpendem on Wednesday November 23, 2022 @01:42AM (#33715967)
Sorry, I will disagree. It seems like you haven't written any Rust, try it and see how well a Result type works instead of excepting everywhere.
Re:Using Rust at a Startup: A Cautionary Tale by ColonelPhantom on Wednesday November 23, 2022 @06:09AM (#33717736)
The only difference between exceptions and Result are that you need to change your return type to Result, and that you need to add a ? after calls that might fail.

There's also a bit of annoying typing stuff involved, but generally with something like the anyhow crate you can handwave that away too.

Re:Using Rust at a Startup: A Cautionary Tale by kazinator on Wednesday November 23, 2022 @10:11AM (#33720091)
> The only difference

That's a significant difference.

It's the only difference if you're only considering blub exceptions, and not a nice exception system in which raising an exception doesn't immediately unwind, so that you can have remote handlers choosing local restart points and such.

> you need to change

Say I can't change. I want to pass the exception through a third party library I don't control. I don't want to fork it, or can't.

> you can handwave that away too

With what plugin for what editor ... :)