Earlier quoted context omitted.
I don't see how Zig comptime is any simpler than Rust. Frankly, it seems more of a kluge. But we've already been over this before. :)
A single construct does the work, or most of the work, of generics, value generics, const fn, traits, attributes (although I expect some form of attributes might be added to Zig) and macros, and it does so without type-level programming or macro-level programming, both their own mini-languages. A kludge is in the eye of the beholder, but one is simpler than five or six.
What is Rust and why is it so popular?
241–250 of 284 posts
Re: What is Rust and why is it so popular?
#242Earlier quoted context omitted.
> As someone who never much got into systems programming, Rust is a breath of fresh air. I think that's part of the problem :) Because Rust looks high level it appeals to people used to high-level programming. But once you get into systems programming, the issues are different from high-level programming, and you're less happy to pay for features that solve other problems. What I'm saying is, obviously, a matter of t…
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? Ye…
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.
Re: What is Rust and why is it so popular?
#243Earlier quoted context omitted.
I don't see how Zig comptime is any simpler than Rust. Frankly, it seems more of a kluge. But we've already been over this before. :)
A single construct does the work, or most of the work, of generics, value generics, const fn, traits, attributes (although I expect some form of attributes might be added to Zig) and macros, and it does so without type-level programming or macro-level programming, both their own mini-languages. A kludge is in the eye of the beholder, but one is simpler than five or six.
Arguably this combination is more complex than Rust's. It has no way to constrain a comptime type argument (traits), so you get error messages like C++ templates. It has no way to constrain a function to be comptime-compatible (const fn), so you get more error messages like C++ templates. When you want to combine things, you manage phase ordering and idioms by hand, basically re-implementing Rust-like concepts at every use site.
Sometimes one or two more concepts in the language makes things simpler. To use a subject you've discussed before, it's similar to scoped continuations vs full call/cc.
Re: What is Rust and why is it so popular?
#244Earlier quoted context omitted.
A single construct does the work, or most of the work, of generics, value generics, const fn, traits, attributes (although I expect some form of attributes might be added to Zig) and macros, and it does so without type-level programming or macro-level programming, both their own mini-languages. A kludge is in the eye of the beholder, but one is simpler than five or six.
Rust has procedural macros too. And they're not a separate "mini-language" like the C++ template hacks, they just use Rust itself, except with a phase separation involved since they run at compile time.
Re: What is Rust and why is it so popular?
#245Earlier quoted context omitted.
It's mostly a hunch, based on a combination of lots and lots of factors. It's very difficult to explain. From a distance, "embedded" looks like a very homogenous field, but it's nothing like that. Some of the factors that contribute to this hunch -- but bear in mind that they don't apply everywhere in the embedded development space, nor equally, nor to every kind of device -- include: 1. A lot of resource-constrained…
Very interesting breakdown. Do you think that Rust could instead help outsourcing? Similar to how Java's GC keeps teams away from segfaults, could Rust's safety guarantees give companies more confidence that an outsourced team's code would have fewer critical bugs?
Re: What is Rust and why is it so popular?
#246Earlier quoted context omitted.
> I doubt that we'll see it used for low-power/resource-constrained firmware I'm curious what your reasoning is for saying this?
Are you going to use Rust on a PIC12 with 32 bytes of data memory and max 256 code instructions? Of course not. Assembly is still king in this low-powered embedded class and will stay as such for the foreseeable future.
Re: What is Rust and why is it so popular?
#247Still not hyped. The article does not show anything special or new about the language that would attract me personally. Type inference -- nothing new and exists in many other languages. Actually how about compile type inference not only in function bodies? :) Functional niceness with iterators -- also nothing new. It can be even more succinct and elegant in Scala for example. But Scala is not as fast you'd say! Yeah,…
> Actually how about compile type inference not only in function bodies? This is actually an explicit design decision; it means that the analysis is tractable, and that you don't get spooky-at-a-distance error messages.
The number of times I see people recommend "just cut and paste in whatever type the compiler said it expected ..." just makes my hair curl.
It also tends to make the code more obscure and unreadable, sometimes completely so.
Re: What is Rust and why is it so popular?
#248Earlier quoted context omitted.
"My claim was that it is nothing out-of-ordinary". Well I guess will agree to disagree there are pretty prominent cases of very capable people trying to do a project in C++ and failing and then leveraging Rust and actually delivering.
And it would be great to read about such projects. But I have not heard about such. Maybe I would change my opinion.
Re: What is Rust and why is it so popular?
#249Earlier quoted context omitted.
> because it’s new in the same way Haskell is new to a Java dev Do you have any hypotheses about why we don't see as much publicity for Haskell then?
Hey nice to see you here, your SO posts have tremendously helped me learn Rust. I think Haskell is just too abstract for most of us. I love Rust traits and see how it directly came from Haskell but I couldn’t learn Haskell even after like 3 serious tries. Maybe a good portion of the problem is in the documentation and not the language? That said, the extremist purity is simply impractical compared to Rust which gets…
Re: What is Rust and why is it so popular?
#250As an embedded systems engineer I have very mixed feelings about Rust. There are a lot of things to like, but Rust seems to miss the point why C++ didn't replace C and will fail at that for the same reasons. I wish for an economic, unexciting, conservative evolution of C, which I don't see in Rust. I could imagine C++ being replaced by Rust, though I don't think borrow checking is the future of programming. Another p…
That's not a bad description of Cyclone, Rust's direct predecessor. It went nowhere because it was so "conservative" over C as to be deeply unintuitive, and it lacked features that matter to modern programming. Rust is nonetheless far less complex than C++, and that in itself makes it a plausible C replacement.