5 ms·
I kinda think rust is a dead-end. The learning curve is really challenging for most people, and you gain all these new constraints. It competes against languag
by procaryote 1y ago
I kinda think rust is a dead-end. The learning curve is really challenging for most people, and you gain all these new constraints.
It competes against languages that give you memory safety by having garbage collection, or I guess even by using arenas in a few cases. GC comes with a performance hit, but a bit of a performance hit is usually much easier to deal with than having a smaller pool of effective developers
Worse is better
- pimeys 1y agoNah. It's like learning vim, you get over the first shock and then you have a lifetime friend. And another thing is with current coding agents, like the gpt-5-codex, Rust really shines here. The agent can easily guide you through the first borrow checker issues, and the compiler helps the agent to write good code. Source: been writing Rust for a decade now. It is easily the best language I've ever used, still.
- t43562 1y agoI'm experiencing that shock now. Can't create a global instance of my self-made heap datastructure. I'm longing for C memory management at the moment - it seems a tiny price to pay. Now I learn that linked lists aren't possible and one has to use some, frankly, bullshit scheme to pretend to have them. IMO the documentation isn't really preparing people for the new reality of what can be done and how to do things.
- binarymax 1y agoThe way I think about rust is this: you can experience the pain up front while you’re getting your program to compile, or you can experience pain later during runtime in random unpredictable ways. Rust is the former. It takes time to learn how to reduce the up front pain, but I’m so much more confident in the end result. I say this having years of coding background in languages like C, C#, Java, JavaScript, Python, etc.
- t43562 1y agoIt's fair enough but if one isn't writing multi-threaded code or code with some complicated ownership scheme then that upfront investment may never really deliver a return.
- binarymax 1y agoNot true. Whole classes of bugs are just eliminated - most importantly NPEs. I’ve seen tiny scripts in node that crash due to lack of an exception handler, and I’ve witnessed countless runtime errors in Java in the simplest of web services.
- t43562 1y agoI've written utility programs that never bother to deallocate memory because the program needs all of it until the point where it exits anyhow.
- estebank 1y agoYou can do the same in Rust with Box::leak, which takes an owned pointer and gives you back a 'static borrow. The only caveat is that unless you reconstitute the type its Drop impl won't be called, but that's likely exactly what you wanted.
- acdha 1y agoThat’s certainly possible but I think it’s increasingly untrue for all but the smallest programs. The problem is that it’s hard to appreciate how many times your program didn’t crash but would have if you’d used a different language. You don’t need to be very complex before you have the risk of something crashing due to an edge case around values which are almost never null, even in languages like Python.
- t43562 1y agoMy productivity level in C is medium. In rust I'm competely blocked because I want to create a global variable and absolutely none of the described ways in the docs or stackoverflow work for my example. Should I give up on this "bad idea".....well I cannot because I can't accept not understanding why this is not working when people say it can. Compared to C the situation is outlandishly, even hellishly impossible to understand. If I can't understand this one thing then I feel there's no point in continuing so I must stay and battle it till I get it or give up completely. I don't think I've ever hit anything like this in any other language I've ever learned.
- simonask 1y agoLinked lists aren’t just possible in Rust, they are in the standard library. They are just an example of the borrow checker’s limitations, which mean that you can only form a DAG of mutable references. But that’s why we have `unsafe`.
- 15155 1y agohttps://docs.rs/once_cell/latest/once_cell/#lazy-initialized-global-data https://docs.rs/once_cell/latest/once_cell/#lazy-initialized... ?
- bfLives 1y agoIt’s even in the standard library now: https://doc.rust-lang.org/std/cell/struct.OnceCell.html https://doc.rust-lang.org/std/cell/struct.OnceCell.html
- estebank 1y agoHave you read https://rust-unofficial.github.io/too-many-lists/ https://rust-unofficial.github.io/too-many-lists/?
- afdbcreid 1y agoHave you tried to write a linked list as an exercise? I know it's a common beginner exercise in C and C++, but in Rust I really don't recommend implementing data structures as a beginner. While some are possible to implement safely, most require unsafe to implement at least efficiently and aren't very beginner friendly.
- tonyedgecombe 1y ago> It competes against languages that give you memory safety by having garbage collection I wouldn’t use it where I could get away with garbage collection (nor C/C++) but that still leaves enough space for Rust to exist in.
- procaryote 1y agoI guess I just very rarely find problems where GC isn't an option. Even the ones where people say "this has to be fast so we can't use a GC" usually work well with a GC.
- SomeoneOnTheWeb 1y agoI strongly disagree. * The performance difference can be pretty massive depending on scenarios. Sure, most programs don't need it, but still * Rust has not only memory safety but full safety around it. For instance, in Java if you iterate over a list while mutating it you'll get a runtime error. In Rust, it won't compile, preventing you from a possible bug later on * The time you spend learning Rust is so much time saved afterwards because the language is specifically designed to reduce the risk of programming errors. Many things like the absence of a `null` value like we have in Java is an immense time saver when your program gets bigger
- 1718627440 1y agoWhy do you take it for granted that I can't just iterate and mutate and it works just fine?
- afdbcreid 1y agoIt could work, if iteration is using indices. But honestly I prefer it to be an error, as this is often the sign of a bug.
- 1718627440 1y agoI mean plain iteration uses function calls. Iterators are a more advanced concept that needs wrapper objects and function calls. > as this is often the sign of a bug. Why? I've just written that yesterday, I had never a problem with that. For example after deleting an element from an array I need to commit this change, by adjusting the size, etc. Why is it so unexpected that I also need to adjust the index? The index needs to be modified anyway. Where is the notion coming from that this is less preferable than the workarounds, like marking some elements for deletion and then iterating a second time or by making a second container and moving everything that shouldn't be deleted (.filter) ?
- afdbcreid 1y agoExactly. You need to adjust the index, and if you don't you have a bug. But how to adjust the index depends on what you're doing. And sometimes it's a simple bug where you never meant to modify the collection.
- simonask 1y agoRust competes with both GC languages (offering way superior performance) and with C++ (offering safety and modern language features). It’s a pretty strong value proposition, but it doesn’t mean there aren’t good reasons to pick a GC language if you can afford the performance hit. The list of reasons to pick C++ over Rust is very short, mostly momentum, recruitment, and legacy. For greenfield projects, the list is even shorter. The general experience is that developing software in Rust is slightly more expensive compared with, say, C#, and way, way cheaper than C++.
- Wowfunhappy 1y agoI get the sense that Rust is probably a much better replacement for C++ than C, and that Rust discussions frequently devolve because C programmers and C++ programmers are talking past each other, without understanding the divide.
- gaanbal 1y agolanguages with a gc are using rust to deal with their horrific performance. look at python and javascript.
- afdbcreid 1y ago"Languages with GC" aren't just Python and JavaScript, and they're amongst the slowest language in this camp.
- School-Cotton 1y agoRust is much easier to learn and use than C++, its main competitor.