Hacker News new | ask | show | jobs
by yau8edq12i 756 days ago
I program MCUs as a hobby. I wish I could use something better than C. Even C++ with RAII would be better. But somehow, even C++ support is spotty, with unsupported features, broken debugging, etc. for seemingly no reason. And all device-specific libraries are written in C, so I'd have to write C++ wrappers for every little thing. Send help...
3 comments

That's why I said "almost anything". I am aware that f.ex. kernel development and embedded work is still firmly in the C domain.

I am not evangelizing for Rust, Golang or anything in particular. I am evangelizing for periodically asking yourself "Am I still using the best tool for the job?" which most people never do.

Actually, maybe Rust would get more people interested if it didn't sound like a religion...
It’s a cult, but you don’t have to join the cult. I use Rust both privately and more and more frequently professionally and I don’t really notice the cult community outside of smiling at it once in a while when it blows up on HN.

We’re mostly adopting rust to replace our C, to protect us from ourselves. It’s just so much easier to hand off these sort of projects to developers who mainly work with things like Java or C#. Partly because of the memory “safety” but also because things like enums work the way they expect them to being sum types, and so on. It’s also very clear when something is intended not to be mutable. The borrow checker is probably the biggest struggle, where with C, everything is a struggle.

Rust still has a long way to come though, and maybe it’ll never get there. I do think we’ll see an uptake as performance increasingly matters due to cloud costs and ESG. Right now though, I’d argue that unless you know why you “want” to use Rust then maybe you shouldn’t.

I saw your comment on an older C# thread in which you said (paraphrased) that C# is not bad, has nothing really stellar, and is just kind of bland.

If you could theoretically swap out the entire back-end of a programming language, and hypothetically you did that to C# by allowing developers to write C# styling and syntax that could be compiled to Rust, it would probably not be a big loss. The type primitives would be an apples-apples comparison at best, or "Rust is just better" if you really scrutinized the types closely. Where does that leave the rest of the language? A better regex implementation? Rust would probably win. A better GUI experience? Rust is speedily approaching usable APIs there at the same time Microsoft is trying to sunset the best they had.

I wonder if F# could be rebased on top of Rust...

Mostly agreed with your comment though I still have to remark that every community has zealots and it's mystifying to me why are people so annoyed by Rust's. So it's hard to agree that "Rust is a cult".

As you said, it's a pragmatic but also kinda niche language. I don't reach for it unless I can't do the job with others, easier and quicker to work with languages.

> ... every community has zealots and it's mystifying to me why are people so annoyed by Rust's.

Because they're the ones that we keep hearing from right now. When it was the Haskell zealots showing up every few days, they were annoying. When it was the Lisp zealots, they were annoying.

Right now? Like where? Be specific and use arguments and not feelings.
The C sphere is actually refreshingly free of zealotry (mainly I guess because there isn't such a thing as a "C community" and even despite C being the main attack target of language zealots - funny enough nobody complains about those pesky assembly coders and their hippie attitude towards memory safety lol).

The "religious zeal" was also an important reason why I switched back to C from C++ and why I don't have much interest in Rust. I can't quite stand the "holier than thou" attitude in.parts of those communities.

> This was an important reason why I switched back to C from C++ and why I don't have much interest in Rust. I can't quite stand the the "holier than thou" attitude in.parts of those communities.

This is 100% baffling to me. Let me explain.

1. Every single area has zealots. Yours included. And we're not talking only work. Every hobby area as well.

2. What the attitude of the most toxic 0.1% of the users of a thing is has exactly ZERO correlation with whether the thing is good and worth using.

3. By resisting only those 0.1% toxic zealots you are only demonstrating meaningless rebelliousness. As a supposed adult you should be immune to what are people hyping up and form your own opinion. INFORMED opinion. Not one based on the "many people praise it hence I, the intellectual, will stay far away from that obvious nonsense" stance.

4. Have you considered that maybe, just maybe, Rust is praised because it's actually good? Have you considered that the Rust community is not trying to cheat its way into your heart, and that the love Rust gets is justified by the people who need its features? Seems like you did not, and that's disappointing.

In other words, I have zero clue of your thought process here, maybe you can help me understand?

Back in my home town the VW Golf had an ardent fan base, yet one of my friends still bought one after he graduated. He didn't call the people who loved VW Golf zealots. He did his research and concluded that with his budget and mechanic skills the VW Golf is the ideal option.

Food for thought?

Are you sure? The C sphere overlaps with the UNIX one, for obvious reasons.
Maybe it's you and some other curmudgeons projecting -- worth to consider if that's the case.

Maybe it's normal for people to praise something that legitimately solved their problems. I know that happened with me.

There is a difference between praising and preaching, the latter happens more often with rust
If you say so. ¯\_(ツ)_/¯

But even if it was true (I'd contest it's not) can't you ignore it and judge the language on its merits? We are not teenagers for a long, long time now, we should be making up our own mind about things.

> we should be making up our own mind about things

But you denied my right to make up my own mind about Rust based on what its proponents say.

I believe you even attempted to insult me, too bad I don't know what curmudgeon means :)

Before the current "AI" hysteria, HN was full of "I've rewritten this thing that was working just fine in Rust". No mention of how it's better, has more features - or even has all the original's features - or anything about why you should use the rewrite instead of the original.

Am I supposed to use a tool just because of what it's made of, or because it solves a problem for me?

> No mention of how it's better

No embarrassing buffer overflow CVEs is a very good start.

To me that's an actual selling point and I've migrated from almost all UNIX coreutils to Rust alternatives for that reason alone.

> Am I supposed to use a tool just because of what it's made of, or because it solves a problem for me?

No, as an adult you are supposed to not frame the discussion unfairly and ask the right questions.

Mikroe is still in business selling Pascal and Basic compilers for all kinds of tiny CPU and MCUs since 1997, so some people do value their products.
Rust only works for a few popular targets, but if it is just a hobby then Zig might be an option. C interop is pretty seamless, so you don't face the problem of having to reinvent the universe.
In my experience interop is rarely a language problem, lion share of time is consumed by reading the docs, testing if you understood the docs correctly, testing what's implied but not written in the docs and figuring out how to cope with idiosyncratic interface.