Hacker News new | ask | show | jobs
by patchymcnoodles 207 days ago
I find the comparison about being good for newcomers rather interesting. I would say none of them are easy for beginners. I don't see where C(++) can shine here. For a beginner into systems programming Go would be much easier as example. And if it's about programming in general then there are many, many more languages to choose from that are all easier to learn than C(++) and Rust.
2 comments

> I don't see where C(++) can shine here [..] Go would be much easier

There is a world of difference between the complexity of C and C++. C is in principle quite easy to understand (besides some syntactic quirks), similar to Turbo Pascal back in the day. Go, on the other hand, has various features that are not so easy for beginners to understand (e.g., interfaces with all their rules, or value vs. pointer receivers with all their complex consequences). Since the introduction of generics, the complexity of Go has taken a leap forward, moving even further away from C and closer to C++ in terms of complexity.

Personally, coming from higher level languages (Python, TS, Java, C#) I've found Go by far the easiest to get productive in.

You're probably right that for trivial examples C is, in principle, the simplest to learn and understand. But in reality, non-trivial C projects come with complex build systems, makefiles, macros, endless compiler flags... I've found it pretty hard to, for example, fork a moderately-sized C project and modify it. Hell sometimes even building it is a challenge when you don't understand make/build system errors and how to set up and configure C projects.

Go, however, i could just get up and running. Simple to use modules, simple to import dependencies, simple to build projects, great centralized documentation. Now granted do i fully understand all the nuances of things like pointer receivers and generics? No, but i don't really understand memory allocation in C either to be quite honest, and I've spent more time trying to understand C in my life than i have Go (please understand: extremely little in both cases)

Rust does seem similarly impenetrable honestly, except that it seems much easier to build and manage Rust projects. But I definitely can't even just read Rust code and get it the way i can Go (or even C)

Programmers using high-level languages develop models about how programming works, particularly around memory management, type safety, and abstractions. These models don't transfer to C, so they must be "unlearned" to some degree, which research shows is often harder than learning from scratch. Programmers accustomed to Python, TypeScript, or C# face specific conceptual "paradigm shifts" when switching to C such as manual memory management (as you said), pointer discipline and lack of abstraction (you have to take care of many things which the high-level language offered or took care of).

Programming beginners (to whom my statement applied) lack preconceived notions about what programming "should" be like. They build their mental models around C's paradigms from the start, avoiding the cognitive dissonance experienced by those expecting automatic memory management or rich standard libraries and integrated build systems.

I suppose, but i tried to learn C before i tried to learn anything else. If it had been my only option, i wouldn't have stuck with programming (in fact i didn't, several years passed between trying to learn C and successfully learning Typescript)
Well I know several GC-based languages but for others:

C was easy to learn, hard to use. C++ was hard to learn, hard to use. Rust was hard to learn, easy to use. Rust was only one of those I was able actually learn and use.