News for hackers. Stuff that matters.
Re:C’s Biggest Mistake (2009) by johnisgood on Saturday September 12, 2020 @07:45PM (#24456916)
One of the niceties of C is that I can get anything done pretty damn quickly, without anything getting in my way. The syntax is extremely simple, too, vs. Rust. Rust is close to Perl when it comes to syntax; full of symbols. Too implicit for me. I want to look at the code, and I want to understand what the heck is going on, even if it is written by someone else. I usually do, with C. Rust? Not so much, and believe me, I tried. I would not like to call myself an idiot, either. :)

A viable C replacement is Ada, although it is not for people who dislike the "code is documentation" bit.

Re:C’s Biggest Mistake (2009) by leetcrew on Saturday September 12, 2020 @08:37PM (#24457196)
> One of the niceties of C is that I can get anything done pretty damn quickly, without anything getting in my way.

not saying you're necessarily wrong (c is definitely simpler than rust), but I think most people would write a similar comment for whatever language they feel most comfortable with. I write c++ most days. even though it's the most verbose and complicated language I've ever used, I can still probably get stuff done way faster than in another language I happen to pick up.

if I'm just throwing something together really fast, I do mostly use the old school C functions though. scanf is way nicer than streams.

Re:C’s Biggest Mistake (2009) by peterwwillis on Saturday September 12, 2020 @09:02PM (#24457303)
Agreed - in that I write it in Perl if I need it to just work right now. Perl is still, to me, the most useful programming language for completing a generic program in the smallest amount of time. (Part of that is due to CPAN, and part to the gazillion built-in features of Perl 5)
Re:C’s Biggest Mistake (2009) by jes on Sunday September 13, 2020 @02:17AM (#24458803)
I agree. I’m an older programmer (almost 61) and I’ve been using Perl for a long time - maybe 20 or 25 years. I reach for it when a job feels like a bit too much for a bash (1) script.

I don’t go out of my way to teach or suggest Perl to my younger colleagues. I don’t know why that is. They don’t usually reach for Python, which I think would probably be their best choice.

Maybe I’m just a curmudgeon ... and by the way, can you please stay off my lawn?

:)

Re:C’s Biggest Mistake (2009) by jkoudys on Saturday September 12, 2020 @10:51PM (#24457838)
One way rust's just a different tool for a different job, is it really doesn't optimize for knowing everything that's happening inside someone else's code. It's a great example of the difference in procedural vs functional programming, where in rust you mostly just care what your function args are and what it returns.

Nothing wrong with learning multiple languages, of course. C was my first professional language, and I spend most of my days in rust now. No shortage of rust devs who are big on C too.

Re:C’s Biggest Mistake (2009) by johnisgood on Saturday September 12, 2020 @11:07PM (#24457943)
Sure. I code in C, Go, OCaml, Ada/SPARK, Factor (Forth-like, Lisp-y), Common Lisp (rarely), and Erlang (moving to Elixir).

But I was responding to "C code is being replaced by Rust fast.".

Re:C’s Biggest Mistake (2009) by dnautics on Saturday September 12, 2020 @11:20PM (#24458001)
You might like zig. It's still pre 1.0, but I feel like it really has that "get out of your way" feel of C with a ton of safety. If you write tests, you can get tested memory safety, too.
Re:C’s Biggest Mistake (2009) by TeaDude on Sunday September 13, 2020 @07:52AM (#24460230)
Zig has a LOT of good stuff going for it but one of my pet peeves is how arsey the linter gets about formatting. No tabs (They might begrudgingly fix that one), no multiline comment/string support (and before anyone tries to correct me on the strings front, you look at that syntax and tell me it isn't an intentional joke), you must use these specific line endings (That one was actually fixed in master recently iirc)

The syntax is also currently REALLY unstable. As in: The hello world has changed almost every major version. Hopefully that too will be squashed with 1.0

To be fair though, Zig is probably the lest egregious and most flexible of the modern "C killers". I can see it's really trying to innovate low level programming. I really like it's flexible malloc systems and support for dynamic linking at runtime. It's compile time code execution is excellent too. The fact that they're actually trying to support obscure platforms like the z80 is a good indicator that they're staying true to C's "code anywhere" mantra. That's why I'm mostly focusing on linting issues of all things.

Re:C’s Biggest Mistake (2009) by jkoudys on Sunday September 13, 2020 @09:55PM (#24465951)
Ah. If anything, the whole "rust as better than C for everything" thing is starting to hurt its reputation, regardless of veracity. People get so focused on its use in perf-critical applications they ignore its other strengths. eg I've never replaced C code with it, but we redid our whole PHP backend as a rust app, because it's great for rigidly defined business rules too.
Re:C’s Biggest Mistake (2009) by jkoudys on Sunday September 13, 2020 @09:54PM (#24465944)
Ah. If anything, the whole "rust as better than C for everything" thing is starting to hurt its reputation, regardless of veracity. People get so focused on its use in perf-critical applications they ignore its other strengths. eg I've never replaced C code with it, but we redid our whole PHP backend as a rust app.
Re:C’s Biggest Mistake (2009) by diegocg on Saturday September 12, 2020 @08:09PM (#24457043)
Young programmers seem to prefer learning Rust than C. Generational replacement will take care of making Rust prevalent, no matter what existing programmers think.
Re:C’s Biggest Mistake (2009) by saagarjha on Saturday September 12, 2020 @10:31PM (#24457715)
Do they? Or are they just told that they should be using Rust? Even putting aside outdated curriculum, Rust is a fairly involved language to teach to a new programmer.
Re:C’s Biggest Mistake (2009) by johnisgood on Saturday September 12, 2020 @11:10PM (#24457962)
Indeed. What languages are most common in universities anyways? Haskell? Java? C++? OCaml? Which ones are the most common?

Maybe he meant outside of the education system. I think the reason for that would be hype and peer pressure, and the feeling of novelty, with a hint of FOMO. I do not see any languages being pushed/hyped as hard as Rust.

Re:C’s Biggest Mistake (2009) by souprock on Sunday September 13, 2020 @01:53AM (#24458715)
I investigated this in Florida. I checked Florida Tech, Embry-Riddle, and a half dozen state universities. One was Java, two or three were C++ (really C with cout and maybe vector), and all the rest were plain C.

That is a mighty good showing for C.

Re:C’s Biggest Mistake (2009) by mslm on Sunday September 13, 2020 @04:11AM (#24459312)
I can't imagine universities actually caring to teach new programmers Rust... it's an overly complex language that most professors themselves would steer far away from because they know there's more to programming than following trends.

(We learned C++ in university in New York which was basically C with occasional help from C++'s standard library).

Re:C’s Biggest Mistake (2009) by saagarjha on Sunday September 13, 2020 @05:50AM (#24459691)
Sadly the latter is often how C++ is taught even though it is not at all how modern C++ is used…
Re:C’s Biggest Mistake (2009) by Gene_Parmesan on Sunday September 13, 2020 @05:51AM (#24459692)
My much younger brother is currently enrolled at a a major university in comp sci. His coursework is primarily in Java but with certain classes in C and other languages.
Re:C’s Biggest Mistake (2009) by saagarjha on Sunday September 13, 2020 @05:49AM (#24459685)
My guess is that those four see more use than Rust does, with Java and C++ forming the base of a typical undergraduate curriculum alongside Python and C and Haskell and OCaml showing up in classes where the concepts behind them are typically introduced. (FWIW: my college experience was C++, C, Scala for the required courses.)
Re:C’s Biggest Mistake (2009) by johnisgood on Saturday September 12, 2020 @08:21PM (#24457124)
I believe we will come back to C eventually. Kind of irrelevant but: I learnt C by writing mods for ioquake3 forks. :) Fun times. I was about 13 years old.
Re:C’s Biggest Mistake (2009) by otabdeveloper4 on Sunday September 13, 2020 @04:43AM (#24459409)
Lol.

For every young programmer learning Rust there are probably 10000 learning C.

C is still the only language you can count on anyone with a programming-related education to have knowledge of. (That doesn't translate into being able to program is C, but still.)