News for hackers. Stuff that matters.
Re:Cloudflare outage should not have happened by svieira on Wednesday November 26, 2025 @02:12PM (#46061242)
All that means is that the `Failure` bubbles up to the very top of `main` (in this scenario) because we're only caring about the happy path (because we can't conceive of what the unhappy path should be other than "crash") and then hits the `panic("Well, that's unexpected")` explicitly in Place B rather than Place A (the `.unwrap`). I'm not sure how that's _better_.
Re:Cloudflare outage should not have happened by jacquesm on Wednesday November 26, 2025 @02:47PM (#46061581)
It would not because it would be a compile time error rather than run time error which is a completely different beast if I understand the argument correctly.
Re:Cloudflare outage should not have happened by Dylan16807 on Wednesday November 26, 2025 @06:26PM (#46063475)
What would be a compile time error? The compiler rejecting unwrap? And then you fix that by bubbling the error case up, which fixes the compiler error and leaves you with a runtime error again. But one that's less ergonomic.

You can't force a config file loaded at run time to be correct at compile time. You can only decide what you're going to do about the failure.

Re:Cloudflare outage should not have happened by jacquesm on Wednesday November 26, 2025 @06:48PM (#46063661)
The point they are - trying, apparently - making is that if you had a flag or an annotation that you could make to a function that you do not want that function to be built on top of anything that can 'unwrap' that you can rule out some of these cases of unexpected side effects.
Re:Cloudflare outage should not have happened by echelon on Wednesday November 26, 2025 @02:50PM (#46061610)
Not really. Handler and middleware can handle this without much ceremony. The user gets to, and is informed of and encouraged to, choose.

We also don't get surprised at runtime. It's in the AST and we know at compile time.

The right API signature helps the engineer think about things and puts them in the correct headspace for systems thinking. If something is panicking under the hood, the thought probably doesn't even occur to them.

Re:Cloudflare outage should not have happened by svieira on Wednesday November 26, 2025 @09:52PM (#46065020)
Yes, but my point is that without a reasonable supervision tree and crash boundary the difference between a composition of Result-returning functions that bottoms out in main's implicit panic and an explicit panic is nil operationally.

While lexically the unwrap actually puts the unhandledness of the error case as close to the source of the issue's source as possible. In order to get that lexical goodness you'd need something much more fine grained than Result.