News for hackers. Stuff that matters.
Re:Python can run Mojo now by ForHackernews on Monday June 23, 2025 @05:08AM (#44353768)
I've tried learning C a couple times and given up because the curve is too steep to be worth the climb. It's not even the language itself, it's the inherited weight of half a century's worth of cruft. I can't spend weeks fighting with compiler nonsense, header files and #include. Screw it, I'll just use Go instead.

I'm learning Rust and Zig in the hope that I'll never have to write a line of C in my career.

Re:Python can run Mojo now by blks on Monday June 23, 2025 @05:22AM (#44353830)
Geez, what a comment. C is much much more simpler than Rust. You’re not supposed to be spending weeks fighting includes or compiler errors, that means you’re have some very basic misconceptions about the language.

Just read K&R “The C programming language” book. It’s fairly small and it’s a very good introduction to C.

Re:Python can run Mojo now by m11a on Monday June 23, 2025 @05:31AM (#44353876)
C syntactically is straight forward, but conceptually may be harder than Rust. You’re exposed to the bare computer (memory management, etc) far more than with a GC language or even Rust arguably, at least for simple programs.

Towards deployment is even harder. You can very easily end up writing exploitable, unsafe code in C.

If I were a Python programmer with little knowledge about how a computer works, I’d much prefer Go or Rust (in that order) to C.

Re:Python can run Mojo now by blks on Monday June 23, 2025 @05:35AM (#44353888)
Rust memory model is very complicated. C memory model is very straightforward.
Re:Python can run Mojo now by DasIch on Monday June 23, 2025 @05:54AM (#44353986)
C before C11 has no memory model. Rust doesn't have one but effectively it inherits the C++/C memory model, so there is actually no difference.
Re:Python can run Mojo now by ynik on Monday June 23, 2025 @07:06AM (#44354416)
That applies only if you take "memory model" to mean modeling the effects of concurrent accesses in multithreaded programs.

But the term could also be used more generally to include stuff like pointer provenance, Rust's "stacked borrows" etc. In that case, Rust is more complicated than C-as-specified. But C-in-reality is much more complicated, e.g. see https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2263.htm

Re:Python can run Mojo now by tialaramex on Monday June 23, 2025 @06:53AM (#44354345)
The model you're referring to, a Memory Ordering Model, is literally the same model as Rust's. The "exception" is an ordering nobody knows how to implement which Rust just doesn't pretend to offer - a distinction which makes no difference.
Re:Python can run Mojo now by ModernMech on Monday June 23, 2025 @10:20AM (#44356071)
This is true, but when you get something wrong related to the memory model in C, it just says "segfault". Whereas in Rust it will give you a whole explanation for what went wrong and helpful suggestions on how to fix it. Or at the very least it will tell you where the problem is. This is the difference between "simple" and "easy".
Re:Python can run Mojo now by codethief on Monday June 23, 2025 @05:30AM (#44353870)
I do sympathize with the parent: The language itself might not be that difficult but you also have to factor in the entire ecosystem. What's the modern way to a build a GUI application in C? What's the recommended way to build a CLI, short of writing your own arg parser? How do you handle Unicode? How do you manage dependencies, short of vendoring them? Etc.
Re:Python can run Mojo now by tialaramex on Monday June 23, 2025 @06:57AM (#44354370)
Errors too. When, inevitably, you make mistakes the C might just compile despite being nonsense, or you might get incomprehensible diagnostics. Rust went out of its way to deliver great results here.
Re:Python can run Mojo now by ForHackernews on Monday June 23, 2025 @05:53AM (#44353979)
Even more than that: "How do you do a string?" has like 100 answers in C depending on what libraries are available, what your deploy target is...
Re:Python can run Mojo now by blks on Monday June 23, 2025 @05:38PM (#44360421)
I am not arguing about how good or easy it is to use C in production, I’m merely stating that parent complaints about weeks of insolvable errors and issues with includes screams that he needs to read some good resource like book, because he is definitely misunderstanding something important.
Re:Python can run Mojo now by Certhas on Monday June 23, 2025 @05:55AM (#44353996)
THe thing is, if one is an expert it is incredibly difficult to understand the beginner perspective. Here is one attempt:

C is simpler than Rust, but C is also _much_ simpler than Python. If I solve a problem in Python I have a good standard library of data types, and I use concepts like classes, iterators, generators, closures, etc... constantly. So if I move to Rust, I have access to the similar high-level tools, I just have to learn a few additional concepts for ressource management.

In comaprison, C looks a lot more alien from that perspective. Even starting with including library code from elsewhere.

Re:Python can run Mojo now by pjmlp on Monday June 23, 2025 @05:26AM (#44353843)
Agreed, I do bash C a lot, and it has plenty of issues, but hardly a monster that a mythological hero has to face.

And as tip for pointers, regardless of the programming language, pen and paper, drawing boxes and arrows, are great learning tools.

Re:Python can run Mojo now by goodpoint on Monday June 23, 2025 @05:38AM (#44353902)
Writing hello world in C is easy. Writing complex software without memory issues and vulnerability is pretty hard.