3 ms·
For me I’m currently playing with async and finding myself needing nightly. I suspect a need for that will drop in the community once GATs land so it’ll be inte
by vlovich123 6y ago
For me I’m currently playing with async and finding myself needing nightly. I suspect a need for that will drop in the community once GATs land so it’ll be interesting to see how the nightly usage changes.
I’m also curious if the % using nightly number is getting skewed by the population growth of Rust itself rather than language feature changes itself (assuming the study is actually sensitive enough to confidently state a 2% change is outside of the error margin).
- steveklabnik 6y agoWhat specifically drives you to nightly? Are GATs far enough along that you're actually using them?
- vlovich123 6y agoI haven’t tried GATs. I’m using async_trait crate to poly fill needing that. I can’t recall offhand the unstable features I’m actually using. But generally I think async + traits don’t play well together currently (like you can get it to work but there’s a lot of surprising sharp edges and certain things that aren’t even possible yet). I’m also fully aware that I may not be writing “Rusty” code as I’m mainly coming from a C++ background and exploring Rust on my own. Generally I’d say the async stuff is still pretty confusing. Like not if you’re entrenched in the Rust ecosystem but it seems like you have to choose the runtime you build around (Tokio vs async_std) and they’re drastically different maturity levels and feature sets so it’s more complex then just picking one as now you have to make sure the entire dependency train is consistent (or you end up with multiple competing implementations running within a system) which I’m concerned about as you scale up the complexity of a codebase (and writing code that doesn’t have to care is similarly difficult it seems where you kind of have to choose a specific dependency to get access to even basic I/O). The other rough edge is that certain lifetime stuff in Rust still is over specified I’d consider. The example is unpacking a struct to be parameters for a function. Like do_something(&mut self.x, &self.y) complains that self ownership is being taken in conflicting ways and you have to add two dummy variables instead. It’s definitely better when I played with Rust a couple of years ago and it feels close but it still feels like those rough edges are an unnecessary barrier for beginners. The other one is it feels like the compiler has reduced in power from suggesting what modification needs to be made. Either: 1) I’m writing more complex/different code than before. Possible since I’m doing an async codebase from scratch vs contributing to a more established Rust codebase. 2) most of the corrections it made before have already been incorporated in the automatic stuff the compiler is now inferring meaning the remaining pieces are the hard ones that have never had corrections in the first place. 3) the focus on auto-correction suggestion has diminished so new features are going in without considering as well as before how to guide the user to fix the issue (or these are harder suggestions in this space that haven’t been explored yet as the original suggestions were easier/better studied). The focus switch could even be intentional (other areas of the language need more focus) 4. I’m sure there’s other possibilities. The final nit I’d note is one around crate discoverability. There’s a lot of crates out there and there’s a lack of documentation on them (ie are they abandoned, “finished”, active development) and selection criteria (ie which crate should I use given my project dependency chain, perhaps crowdsourced ML suggestions from other projects like a “Netflix” recommendation with ability to inject additional details like “I’m looking for something that provides certain algorithmic or memory guarantees, is async or not, etc” if those things aren’t available from the existing dependency but a new thing being added). The data is there nominally as fancy charts because that’s kind of easy but the harder proactive advice with explanations is the real gold no one has done and can really push Rust to the next level for engineering efficiency.
- vlovich123 6y agoIf you want to actively observe me writing code by giving me a channel to DM you you can get a sense of my questions and how a historically majority C++ developer since my teenage years is transitioning to this language. I feel like this is a large constituency so figuring out my mental model errors is important to help write detailed transition doc material.
- nindalf 6y agoPlease do note down the questions and publish them later. Steve may or may not have the time since he has a full time job not related to the Rust project, but I’m sure the community would love to read about your experiences.
- scns 6y agoThis might help with your learning: https://www.jackkinsella.ie/articles/janki-method https://www.jackkinsella.ie/articles/janki-method
- steveklabnik 6y agoThanks! I won't have the time to do that, but anything you want to send me, I'm happy to check out. Your other answer is already very comprehensive and useful. I appreciate it.
- dmit 6y agoAll of these have workarounds (obviously), but here are the unstable features I'm using in my most recent (<10kloc) project: #![feature(bound_cloned)] #![feature(const_float_classify)] #![feature(const_fn)] #![feature(const_fn_floating_point_arithmetic)] #![feature(const_generics)] #![feature(const_panic)] #![feature(once_cell)] #![feature(option_result_contains)] #![feature(or_patterns)] #![feature(str_split_once)] once_cell supersedes the eponymous crate. or_patterns are pleasant syntax sugar. bound_cloned, option_result_contains, str_split_once are minor convenience shortcuts for things you can do slightly more verbosely on stable. The other half are all about const generics and const fns. You can emulate some of them on stable, but the cost far outweighs that of switching to nightly in my case.