15 ms·
Rust 2024 the Year of Everywhere?
- paulgb 4y agoasync drop is exciting because it means you can use the RAII[1] pattern for arbitrary resources. I've used this to, for example, manage infrastructure spun up for integration tests. I spin up a Docker container at some point in the test, assign the result to a guard variable, and then use RAII to clean it up when the variable goes out of scope. Making it work without async drop was pretty hacky, so I'm looking forward to removing those hacks. Well done, Rust team! [1] https://en.wikipedia.org/wiki/Resource_acquisition_is_initialization https://en.wikipedia.org/wiki/Resource_acquisition_is_initia...
- Scarbutt 4y agoRust is so simple and elegant.
- buzzdenver 4y agoWas it simple and elegant from the beginning, or did it click at some point? I started learning it from the O'Reily book yesterday, and so far it's easily the steepest learning curve for a language.
- HKH2 4y agoIt's steeper than Haskell?
- buzzdenver 4y agoI can only compare to C, perl, ruby, python or bash.
- echelon 4y agoIn my honest opinion, lifetimes should be hand waved until you've played with the rest of the language. By then it'll follow as naturally as your first lesson on OOP.
- Scarbutt 4y agosarcasm
- ravenstine 4y agoIn my opinion, books are the worst way to learn a programming language. Reading existing codebases and watching tutorials is usually far more effective, especially when you can mostly transfer knowledge of how to do things in one language to another.
- cercatrova 4y agoI wouldn't recommend the O'Reilly book for a beginner, use the official book in the docs, and do Rustlings alongside that. That's how I learned. Rustlings especially smooths you into the concepts while the O'Reilly book starts off writing a Mandelbrot generator as the first project, which put me off of that.
- ilovecaching 4y agoThis is why Rust will eventually become the next C++ - it's becoming just as bloated with type theory, a cumbersome syntax, and will eventually ignite a begrudging dislike by the people that have to find a subset of the language to make sense of just to write simple programs. Everything about this language is overcomplicated by language enthusiasts. The best thing for Rust over the next few years is for it to fall to the wayside while saner approaches like Hare and safer C syntaxes take center stage.
- gouda-gouda 4y ago
- llanowarelves 4y agoThat's why I don't think it's worth dropping modern C++ for it. Only major thing C++ was missing that I wanted is modules. Yeah you have to have high enough agency to use a subset of the language, but so what? I dont plan on having 300 interchangeable human NPCs smashing keys on it, like Go was designed for.
- echelon 4y agoI can imagine a very similar argument being made for punch cards.
- llanowarelves 4y agoHow hard is it to minimize inheritance, use containers in standard library, and use smart pointers though? That's 90% of the difference between pre-c++11 and post-c++11 best practices. And a couple other "dont do this" rules.
- paulgb 4y agoI don't get it, where's the bloat here? By using consistent rules across the language, Rust is requiring developers to keep less in their head. The author acknowledges this: > Newer users find Rust easier to use and more consistent; they don’t have to learn the “edges” of where one thing works and where it doesn’t. E.g. currently, Rust users have to know that if they want to use async on a trait, they need to add a dependency to the async_trait crate. Soon they won't.
- cutierust 4y ago
- andrewstuart 4y agoMy theory is that every technology that is too complex gets replaced with something that does the same thing more simply. You see this relentlessly in the JavaScript ecosystem where waves of too-complex tools get rapidly replaced with something else, only to be swept away again when someone finds an even more simple way to do the same thing. This must be the fate of Rust - eventually it will be replaced with a language that gives the memory and thread safety without the melt-your-brain complexity. I want a simpler version of Rust. It's too hard. Is it possible to create a truly safe language without the dizzying complexity? Or is it the complexity a baseline requirement? I wonder if there is a subset of Rust that can be extracted someone into a new, minimal language with the core benefits.
- goodpoint 4y agoYou want Nim.
- echelon 4y agoWriting Rust/Actix for server code is a breeze. There's zero complexity. It's practically Java, just with a more Ruby-like syntax. Entirely depends on what you're building. Edit: You can have a small Actix app up over the weekend and never touch "lifetimes" until you're ready.
- andrewstuart 4y agoAfter my initial failed attempt to learn Rust I then took a second shot at it by writing Actix web code and had alot more success. This is the path I would take if I was returning to Rust. Having said that, I felt that for the most part this approach was just avoiding the task of learning the complexities. But, I do believe that learning something hard starts by learning a little bit of it and building on that initial foothold.
- lossolo 4y ago> Entirely depends on what you're building. Exactly this, if you are building some CRUD app then it's as easy as using Java or Go etc, because basically there you have request -> contact some db -> return result, maybe do some processing of that data, so no need to fight borrow checker at all. But if you build something like multiplayer game server with lots of state of 3D world that constantly changes and interacts with itself, that is operating on self referencing data structures etc then it's not as easy as in GC language.
- robbintt 4y agoI'm just sitting here learning c++.
- BatFastard 4y agoI am relearning c++, much has changed in last 12 years! I tried Rust, but when doing a data driven app, I found myself using unsafe way too much!
- petre 4y agoYou should both probably try D. It can use C/C++ libraries seamlessly and doesn't have the footguns or the needless complexity.
- Gigachad 4y agoWhy are people always more afraid of unsafe than C/++? Using C++ because you had to use unsafe is throwing the whole house out with the bath water. It’s like Rust forces people to acknowledge when they are taking things in to their own hands while C/++ let’s them live in blissful ignorance.
- davidatbu 4y agoThis is indeed very curious!
- nyanpasu64 4y agoBecause unsafe Rust has at least as many footguns, and a narrower happy path (second-class support for shared mutability, raw pointers are a pain to use and encapsulating in a handle struct might help though I haven't tried writing code this way, Pin violates SB, Box may or may not disable aliasing raw pointers), than C++.
- Decabytes 4y agoFor those who want something less complex than Rust, but with some of the baggage of C++ removed, I would recommend trying D.
- deleted 4y ago[deleted]
- SmileyKeith 4y agoFYI your website's CSS on mobile causes unexpected horizontal scrolling issues
- jherico 4y ago
- tupshin 4y agoYour comment has nothing to do with the blog post, which is about when rust features can be used (in combination with each other). > Up until now, Rust has had a lot of nice features, but they only work sometimes. By the time 2024 rolls around, they’re going to work everywhere that you want to use them, and I think that’s going to make a big difference in how Rust feels.
- infogulch 4y agoEvery time there's a new post about 'big new features' in current or future Rust releases there's someone shouting in fear of how Rust is getting more and more complex. Rust may be complex, but 99% of newly added features have not made it more complex than the initial release. Consider a different language with three orthogonal features. You could think of its 'design space' as a cube, where each feature corresponds to a dimension, and where code that uses some features are a point in the space. If the implementors of this hypothetical language didn't know exactly how all three features should interact together but they could figure out how pairs of features would work, you could imagine their initial implementation as the same cube with a chunk missing out of the corner. Later, after users and implementors gather experience about how the language feels, they make a big proposal: The next release will be a full cube instead of a cube with a corner missing! Wow! Now the big question: did this release make the language "more complex"? Well, it is more capable. But it doesn't add any new orthogonal concepts, it just filled out the full space that was implied by the original three. And arguably "cube" is simpler than "cube with a corner missing". The design of Rust is the cartesian product of about five primary orthogonal features on top of some basic concepts that might be familiar to C programmers. Maybe they are: lifetimes, generics, traits, enums, unsafe. (Argue away if you choose a different five.) When these features were chosen all the way back in 2015 the designers did their best to consider what might happen if you tried to use various combinations of them at once; but crucially, large portions of the corners of this 'space' were left unimplemented simply because it was too hard to do all at once [1]. 65 releases later, Rust has added very few new features -- as in orthogonal concepts -- [2] but has made a lot of progress filling in bits of the design space that was unimplemented but implied by the original five. And that's literally what this whole article is about: Niko's vision for filling in Rust's implied design space that was left unimplemented for practical reasons, "Making Rust feel simpler by making it more uniform". [1]: At some point after you've laid the foundation for a big idea it's better to let your idea tell you how it wants to work instead of forcing it, and that requires time and experience with it. [2]: async, and that's it?
- gouda-gouda 4y agoThis is the right take. Nikos vision is about polishing what’s already refinement, polishing what’s already there.
- sam0x17 4y agoAs a library author a big aha moment for me was being able to write proc macros. There are so many creative (and simple to implement) ways of getting around certain limitations when you can just do some smart code-gen. I think a lot of people get overwhelmed by the limitations before considering what the world of proc macros has to offer.
- egnehots 4y agoas a library user, I dread proc macros since they are often associated with slow, long compile times.
- planetis 4y agoMeanwhile Nim achieves similar results with a fraction of the cost. And less braindead fanfare.
- int_19h 4y agoAnd a GC, if you want similar degree of memory safety.
- up2isomorphism 4y agoNo matter how you think your language will be whatsoever, it is just your crowd. For the rest of the world, it does not matter at all. It is just a tool, if I need I will use it otherwise I won’t spend a single minute to look at it. Also if you think memory safety is the hardest problem in programming, you probably haven’t written any non-trivial program anyway.
- taylodl 4y agoI'm a software developer with over four decades of experience under my belt in every environment you can imagine - startups, manufacturing company, utility, retail, banking, education - and here's a trend I've noticed in that time: many languages come, a few stick, and they're slow to fade away. Very few have stuck around for decades. Today's darling is tomorrow's pariah. Cobol, C/C++, and Java are great examples of that. Where is Rust? It's behind Cobol on the TIOBE index. That puts things into perspective. I remember when C took the world by storm in the early 80's. That was a result of severely underpowered 8 bit and 16 bit computer where your only alternative for getting any performance was to write in assembly. C's ability to be used as a high-level assembler were its killer feature. Java had a similar ascendancy in the 90's. There were several widely-available CPU architectures that were popular at the time and it's ability to write-once, run everywhere with acceptable performance was its killer feature. It certainly didn't hurt that it borrowed heavily from C's syntax. What is Rust's killer feature that will compel widespread adoption? The borrow checker? I don't think so, and the market doesn't appear to think so either. To wit, both C and Java enjoyed a meteoric rise within five years of their release to the public. Meanwhile Rust is nearly eight years old and yet still is lagging behind Cobol. I don't see the situation being much different two years from now when Rust is 10 years old. I have a couple of questions then. Why do you think Rust will ever experience widespread adoption? Assuming it won't (which appears to be the case), for what programming communities would you expect for Rust to have widespread adoption?
- pornel 4y agoAccording to TIOBE, C has lost 60% of its popularity between 2015 and 2017, and then doubled next year. What's more likely: that a 40-year-old language C had such a massive sudden swing, or that TIOBE data is garbage and measures search engine's algorithms, not language relevance? https://blog.nindalf.com/posts/stop-citing-tiobe/ https://blog.nindalf.com/posts/stop-citing-tiobe/ BTW: According to the TIOBE horoscope Rust is way ahead of TypeScript and Bash.
- taylodl 4y agoI don't see the 60% drop in popularity between 2015 and 2017 as you claim (see https://www.tiobe.com/tiobe-index https://www.tiobe.com/tiobe-index). C has never not been in the top 5 languages used since the index was created 35 years ago. There have been numerous cycles where it's been #1. There's been very little volatility in the top 10 for the past 10 years, as opposed to the 25-50 ranked languages where Rust resides which has considerably more volatility in their rankings. That's why a lot of people consider anything beyond the top 25 to be just noise.