5 ms·
I like Rust, but based on the difficulty I’ve had writing even the most basic of bare metal software in it, it will be like 10 or 15 years before the community
by unsatchmo 8y ago
I like Rust, but based on the difficulty I’ve had writing even the most basic of bare metal software in it, it will be like 10 or 15 years before the community and the tooling are ready to do kernel or device driver work in Rust. C may have a lot of foot guns but it’s really easy to learn and use.
- bluejekyll 8y agoRust took me longer to learn than most languages, I'll grant you, but I'd say after 3-4 weeks I was writing safer code than anything I ever wrote in C. Not claiming to be an expert in C, but I paid my share of blood and tears with it, and all I can say is that it's worth the effort to learn Rust for the huge guarantees the language gives you in the same contexts as C. If you're interested in baremetal, there are a number of tutorials out there, all focused on different things. I really love the TockOS tutorials, they are really awesome for getting across some of the different benefits at different levels: https://github.com/tock/tock/tree/master/doc/courses/rustconf https://github.com/tock/tock/tree/master/doc/courses/rustcon... And then more raw OS stuff: https://os.phil-opp.com/ https://os.phil-opp.com/
- pjmlp 8y agoRust is already at a good level when you are writing low level OS infrastructure code and CLI utilities. For GUI software or GPGPU development, it still needs to mature a bit more.
- bluejekyll 8y agoYes, though I think patterns are starting to emerge that will start taking hold. For example: https://raphlinus.github.io/personal/2018/05/08/ecs-ui.html https://raphlinus.github.io/personal/2018/05/08/ecs-ui.html I mostly think this is a gap in common libraries at the moment and decent coding practices. We’ll see what happens with all of that. Personally I’m more focused on web-backends, micro-services, and DNS, so GUIs don’t generally present problems for me.
- pjmlp 8y agoThanks for the link, it is quite interesting read.
- unsatchmo 8y agoI’m gonna have to disagree with you there: once you turn off std, you’re off the map. Building a syscall handler for example, or implementing VM or even a simple bootloader is non-trivial and has taken me like 10x the time it would in C. If we want rust for device drivers, we need a more sane method of implementing std below userspace. The fact is that C is dead simple and currently contorts more easily. The cognitive load is two orders of magnitude less. Until Rust is this easy, we will use C at work.
- pjmlp 8y agoGiven that I loved doing systems programming in Turbo Pascal, Oberon, avoid to use C as much as possible, focus on Java, C# and C++, I do love a bit of straitjacket in name of security. I do agree though that it might need still some ergonomic improvements to earn the hearts of other developers that don't share this opinion.
- unsatchmo 8y agoYou must be a hell of a lot smarter than me: I’ve been hacking rust on the side and it’s taking me like 10x as long at least to do fairly simple things. It’s like the crushing burden of choice of C++ paired with the strictness of Haskell. And I’m not sure it’s that much safer than C for low level stuff that requires you to use unsafe anyhow. I’m going to take my kernel project through to programming the MMU, and re-evaluate but it’s slow going man. None of my coworkers would have the patience for this slog.
- bluejekyll 8y agoI hope that you’re using some of the many community resources to help learn. I personally don’t have time to join the IRC channels, but those are great for point in time help, the users forum, stackoverflow, and reddit are all good resources too. Many of the Rust users have all gone through similar learning hurdles, and are very helpful when asked. Often there are tricks that newcomers are unaware of for working around some of the Rust idiosyncrasies. I encourage you to reach out. The official community page has a lot of resources: https://www.rust-lang.org/en-US/community.html https://www.rust-lang.org/en-US/community.html
- dbaupp 8y agoSomewhat surprisingly, you can relatively quickly move from the world of raw pointers and direct hardware interaction to safe abstractions (or at least single-point-of-unsafety, typically on construction, requiring that a pointer points to the right memory-mapped registers, etc). The series written by Phil Opp linked above does a great job of demonstrating this.