4 ms·
Part of the problem is that "systems programming" is an overloaded term that means a number of different things. Is writing a web browser "systems programming"?
by orclev 7y ago
Part of the problem is that "systems programming" is an overloaded term that means a number of different things. Is writing a web browser "systems programming"? What about a CLI utility like grep? Kernel module? Bare metal on a STM32? Depending on who you ask most of those will get both a yes and a no answer. On a related note, some language are more or less suitable for each of those. Can you write an OS in Java? Yes. Should you? Probably not.
I think one of the previous comments, and others on other forums have things right when they say that Rust is a better C++. Anything you would consider using C++ for is a good candidate for using Rust for. Rust is not a better C though, it's just a bit too high level for that. There are languages that are aiming to be a better C (Zig is REALLY interesting, but very very new right now), but Rust isn't really one of them.
I could very easily see something like an OS aimed at x86 desktops being written in Rust. Desktop systems are beefy enough and the problem space is complex enough that the extra overhead involved in Rust (similar to C++) makes sense. On the other hand if you're doing some bare metal work on something like an Arduino you just don't have enough there to justify the extra overhead and something very basic like C (or assembly, or Zig once it matures a bit more) is probably a better fit.
If you're doing anything higher level than kernel programming, Rust is just as viable as anything else, at that point it's mostly down to personal preference on whether you can deal with not having conveniences like garbage collection or not.
- pron 7y ago> If you're doing anything higher level than kernel programming, Rust is just as viable as anything else I don't think so because it suffers from the same limitation that all low-level languages have, which is that API clients need to be aware of implementation details. Rust sometimes makes that propagation of leaked information automatically via the type system, but internal implementation details -- how allocated memory is managed, whether a target is a subroutine or a coroutine, whether an argument is passed at runtime or compile-time -- still leak in a viral way. It's just that Rust and C++ can look high-level, but they don't behave like high-level languages. But Rust is great for those low-level programmers who like this high-level style and are willing to pay for it.
- zozbot234 7y agoThat's not a limitation of "low-level languages", it's inherent in low-level API's. These two are not the same. You could have a Rust program that interfaces with outside systems only via protobufs over a network socket, or what have you, and it will work just fine. Same for just about any "high-level API" format you could think of. Of course, using such high-level formats comes at an efficiency cost since you have to translate along the way. But other languages are the same, they just hide that step from you.
- pron 7y agoThe program itself is made of components that expose a low-level API, or otherwise you wouldn't use a low-level language. The API clients are other parts of your program. Programs written in low-level languages are much more tightly coupled than languages that support better abstraction (for the price of less control).
- pjmlp 7y ago> Can you write an OS in Java? Yes. Should you? Probably not. PTC, Aicas and Gemalto embedded JVMs for industrial automation can run either with a real time OS, or directly bare metal with Java Real Time JSR. Android has plenty of Java in it, as of Project Treble it is possible to write user space drivers in Java, something that Android Things supported since the beginning. MicroEJ has a minimal hardware glue in C, with everything else in Java. At CCC there was a demo about TamaGo, bare metal Go for USB security devices, then there is also Astrobe with Oberon-07, the new Meadow boards run .NET Standard based OS. Arduino and ESP 32 support Circuit Python, uLisp, MicroScheme and picoOCaml. So plenty of systems programming examples with GC.