4 ms·
Written in Rust and yet when I downloaded it — admittedly a few months ago now — it segfaulted within a minute of me opening it for the first time. 0/10, not i
by dave4420 3y ago
Written in Rust and yet when I downloaded it — admittedly a few months ago now — it segfaulted within a minute of me opening it for the first time.
0/10, not inclined to try again.
- brabel 3y agoPeople who think the programming language magically makes bugs disappear don't know what they're talking about. Yes, Rust makes a few categories of bugs disappear, but there's a vast number of bugs that you can still easily create even using Rust with all linters you can find enabled... just saw on another thread someone complaining a Gemini (poor man's internet) server responded with a Rust panic coming from an `unwrap()` call :D
- ParetoOptimal 3y ago> People who think the programming language magically makes bugs disappear don't know what they're talking about. Yes, Rust makes a few categories of bugs disappear, I think few categories undersells it. Just having Optional/Maybe in a language legitimately does make bugs disappear.
- lumost 3y agoHot Take: Rust Panic's are about as bad as Sig11s from the C world. I don't get good debug information in the typical case - and library authors get to decide when my program crashes (which I disagree with).
- frfl 3y agoDefinitely a "hot take".
- threatofrain 3y agoOn a tangent — for a numeric library, would you rather NaN or throw? I find a fair amount of division over this question, but people lean towards throw over NaN.
- truculent 3y agoIf the operation can fail, that should really be represented in the type, right?
- zokier 3y agoOne of my random thoughts is that floats could be represented as enums in type system, e.g. in rust-like syntax: #[repr(f32)] enum Float32 { PositiveInfinity, NegativeInfinity, Nan(NanPayload32), Finite(FiniteFloat32), } You could also then define NonNanFloat32 etc which could be used for certain operations. Of course on machine level its all the same
- truculent 3y agoYeah, I think something like this would make sense. I get why people might not like it, but this is what we’re dealing with whether we like it or not.
- brabel 3y agoNo necessarily. Rust doesn't do that for array indexing (though bound checking is enabled at runtime and will panic if out of bounds), division by zero, numeric overflow and probably many cases where it was deemed to be just too cumbersome.
- truculent 3y agoTrue, but iirc Rust also supplies a `get` method for when you want to get elements safely.
- pocketarc 3y agoI'd definitely go with throw - it's indicative of a logic bug, and I'd rather notice it during dev (or if not, catch in prod, complete with stack trace and whatnot), than to have it silently corrupting anything that relies on that calculation happening correctly, without me even being aware of it. Like, if I'm doing x + y, and y just accidentally happens to contain the wrong data because of a mistake in the code, a NaN means the code will proceed as normal, and nobody will notice anything is wrong. If it's not a noticeable bug, it might be a long time until it's spotted by someone. And when they do, who knows how much damage it will have caused.
- ben0x539 3y agoYou're not supposed to be afraid of segfaults, you're supposed to be afraid of the incorrect memory accesses that don't get caught by segfaults.
- corethree 3y agoYeah, the problem is when one of these faults comes from a 3rd party library and doesn't include stack trace info.
- foolswisdom 3y agoWell if you're not using unsafe, you would expect zero segfaults when using rust, no? Though I imagine it's impossible for anything with graphics to avoid unsafe code entirely.
- omnicognate 3y ago> Yes, Rust makes a few categories of bugs disappear, but Segfaults are only one of many ways for software to go wrong.
- n8henrie 3y agoCertainly not all bugs, but in theory a segfault should be entirely avoided in safe rust, right?
- vlovich123 3y agoSegfaults in safe rust cannot happen modulo compiler bugs. A true segfault (vs panic) would require unsafe Rust somewhere. But there’s bound to be unsafe code somewhere in a complex enough project.
- n8henrie 3y agoOutside of FFI, is that mostly just for performance optimization? EDIT: IOW, why don't projects just eschew unsafe in order to truly leverage one of Rust's primary claims to fame?
- vlovich123 3y agoFFI, performance, ownership that’s impossible to express statically, 3p dependencies, direct OS calls or HW management that aren't available with safe wrappers etc. Sticking to safe rust is an ideal and it should be a goal but the primary use is to accomplish a task. If safe rust is getting in the way and there’s no way to do it easily otherwise, don’t feel bad about unsafe. The amount of unsafe should be minimized of course which reduces the surface area of issues greatly compared with c/C++ where every line is unsafe. Practical code is always >> ideological purity.
- dave4420 3y agoIf the makers of a software program make a big deal about the implementation language (in Lapce’s case, they mention it in the first paragraph), then I take that as a statement that they’ve taken advantage about that language’s unique features to deliver better software. In Rust’s case, I take it as a promise not to do anything memory-unsafe. Lapce did not keep this promise when I tried it.
- 3836293648 3y agoDid it crash or actually segfault? Segfaults shouldn't happen in Rust, but there is widespread use of `.unwrap`
- dave4420 3y agoMy memory is that it segfaulted, but this was months ago, so who knows?