6 ms·
State of Rust Survey 2020 results
- nynx 6y agoWhile I'm not sure what group ran the survey, the person who posted this on hn (steveklabnik) is a major reason for the success of Rust's community, which is likely a significant contribution to Rust's success as a whole.
- ArchOversight 6y agoThe survey was posted here: https://blog.rust-lang.org/2020/09/10/survey-launch.html https://blog.rust-lang.org/2020/09/10/survey-launch.html
- steveklabnik 6y agoThank you! It was run by our survey working group, of which I am not involved. So I can’t take any credit here.
- programmarchy 6y agoYour presentation on Rust, WebAssembly, and the future of Serverless was an eye-opener for me and is what inspired me to start programming in Rust!
- shakow 6y agoI'm curious to know what people find to be missing in the Rust/C interop? I only used it for a few simple functions, so I could not hit any hard points.
- eptcyka 6y agoSeeing how Zig has reimplemented the C preprocessor just to make C interop easier/smoother, there's always room for improvement beyond plain old function importing/exporting. I of course, think that C FFI is as good as I personally need it to be. It's as good or better than most other languages that are not C.
- deleted 6y ago[deleted]
- flohofwoe 6y agoZig doesn't just implement the C preprocessor, instead the Zig compiler is also a C compiler, there are no separate compiler toolchains or build systems required for mixed Zig+C projects and you can directly import C headers into Zig source files.
- steveklabnik 6y agoSee https://github.com/dtolnay/cxx https://github.com/dtolnay/cxx as an example of the kind of things people are building to explore this space.
- ChrisSD 6y agoEssentially people would like to be able to move seamlessly between idiomatic Rust and C (or even C++) without needing any manual intervention. This also would ideally include having an automatically safe API but this may require some glue on both sides of the API boundary.
- apendleton 6y agoI think C++ interop is the bigger deal than plain C. You end up needing to launder everything through C because of the lack of standard C++ ABI, plus there's a bunch of ergonomic awkwardness because C++ and Rust have a bunch of standard-library primitives that serve the same purpose but can't by passed by reference directly (vectors, slices, strings, tuples, etc.), and need to be manually marshaled back and forth if you have a Rust-flavored thing on one side but want to use a C++ library that expects C++-flavored things on the other. I think at least for non-mutable stuff, C++ string_view (approximately rust &str), span (approximately rust slices), and the like should make at least some operations as simple as pointer casts, but having tooling to automate the boilerplate would be nice, and they're also new/not that widely supported (std::span is from C++ 20). And mutable stuff, if you want to be able to write idiomatic/ergonomic code on both sides, seems like a much bigger lift.
- vlovich123 6y agoFor 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.
- lmm 6y ago> It does seem that having C++ knowledge helps with 20.2% of respondents with at least some C++ experience noting lifetimes to be “very difficult” while 22.2% of those without C++ knowledge found the topic to be “very difficult”. Overall, systems programming knowledge (defined as at least some experience in C and C++), tends to make for more confident Rust users: those with systems programming experience rated themselves as 5.5 out of 10 on their Rust expertise, while those with experience in statically typed garbage collected languages like Java or C# rated themselves as 4.9 out of 10. Those with only experience in dynamically typed languages like Ruby or JavaScript rated themselves as 4.8 out of 10. Was this just based on self-report? An alternative interpretation could be that C/C++ programmers are just more confident.
- steveklabnik 6y agoIt is based on self-report. I don't think that this statement is an interpretation exactly, it's simply saying that there's a correlation between answers on the survey. You are absolutely right that this may be the underlying cause.
- AlchemistCamp 6y agoIt's a small feature, but I'm really looking forward to seeing this stabilized so I can get off of nightly and still have a break before else statements (aka "ClosingNextLine"): https://github.com/rust-lang/rustfmt/issues/3377 https://github.com/rust-lang/rustfmt/issues/3377