3 ms·
Bzzt. Rust doesn't have exceptions. It has panics. And that's exactly how it's already implemented. If there's a bug, it panics. If you mean "return an error i
by burntsushi 4y ago
Bzzt. Rust doesn't have exceptions. It has panics. And that's exactly how it's already implemented. If there's a bug, it panics.
If you mean "return an error instead," then bzzt again. Read the next section down.
- AshamedCaptain 4y agoBzzt to the language, if anything. Panic practically everywhere is just not an admissible option, most definitely not for anything that tries to call itself a systems language. Proving that there is no reasonable alternative would be equivalent to claiming the language is unusable.
- burntsushi 4y agoThank you, Random Internet Stranger, for teaching me such a valuable lesson. I now know never to use any language that is Turing complete.
- lmm 4y agoTuring complete languages are legacy cruft. There are no compelling use cases where they're actually more expressive, and sheer code execution performance is never the bottleneck in a realistic-sized system.
- burntsushi 4y agoFeel free to back it up with real examples. Otherwise, previous conversations with you have just been frustrating exchanges about pie-in-the-sky stuff. Just seems like you want to be bombastic for the sake of being bombastic. > and sheer code execution performance is never the bottleneck in a realistic-sized system. TIL that code execution perf doesn't matter and I've wasted almost a decade of my life focusing on it. Wow I wish you told me sooner! What a ridiculous comment.
- AshamedCaptain 4y ago> Just seems like you want to be bombastic for the sake of being bombastic. Ironically, that's exactly how you seem when just drop the "Turing completeness" bomb on a discussion about error handling. It's very hard not to see it as a ridiculously childish tantrum, since not only there's no actual argument, it is by definition impossible for it to be relevant to the discussion. Anyway, I would not be writing this if it wasn't because you keep pumping direct personal attacks to everyone who dares counter your posts, which are already in a terrible tone.
- burntsushi 4y agoThanks for the free lesson, Random Internet Stranger. I appreciate it. Unfortunately, the cognitive dissonance you give me is just too much to bare. Your wisdom is clearly beyond reproach, and so therefore Rust cannot be a systems language since it has panics. Yet, I and many others use Rust for systems programming. My brain might explode from the contradiction!
- AshamedCaptain 4y ago> therefore Rust cannot be a systems language since it has panics Or, the obvious alternative that I was trying to point out: your analysis is wrong, and therefore, assuming the language is not useless, there must be a proper alternative to "panics everywhere" * that you are not accounting for ! https://lkml.org/lkml/2021/4/14/1099 https://lkml.org/lkml/2021/4/14/1099 * This is just to explicitly write the phrase again before it is (again) twisted as calling for a strict prohibition of all non-terminating conditions or some other childish nonsense. Even unwinding panics (which are exceptions in all but name) can be an alternative, and Rust does support them.
- burntsushi 4y agoCool, good thing I didn't say to panic everywhere. That lkml post has zero relevance here. He's asking for fallible allocations. Which is totally reasonable. Serious question: did you read the entire blog? If so, can you specifically point out passages you disagree with and why? EDIT: And seriously, I started out this conversation with a serious comment asking you to elaborate on what you meant by asking something very concrete: how would you change the code example in my blog to conform to your view? You decided to flippantly respond with a non-answer in the first place. Why not go back to the original question I asked and give a real answer? If you don't know Rust, then use pseudo code. We're talking about a dozen lines here. It shouldn't take long.
- AshamedCaptain 4y agoHappy to help, albeit I do not see why that is a conclusion of my argument.