News for hackers. Stuff that matters.
Re:JavaScript Structs by eddd-ddde on Thursday October 10, 2024 @03:38PM (#41802662)
This is why always say the true beginner programming language is C.

Stupid easy to learn, have some loops, have some conditions, make some memory allocations. You will learn about the fundamentals of computing as well, which you might as well ignore (unknowingly) if you start with something like JavaScript (where is this data living in my computer?).

Re:JavaScript Structs by lukan on Thursday October 10, 2024 @04:11PM (#41803016)
And this is why I always say, we have a world full of computer consumers, not programmers.

C as a first language is only easy, if you happen to bring along a deep technical interest (and pre knowledge) about the "technical fundamentals of computing".

Most people do not have that.

Tell them about heap and memory allocations and you will get a blank stare.

But show them some simple functions, to make some flashing graphics on the sceen - and they will have fun. And can learn the basics of programming at the same time.

And then you can advance more low level, for those who feel the call. But please don't start with it, unless you have some geeky hacker kids in front of you who really want to learn computers. Then C makes sense. For "normal" people not so much.

Re:JavaScript Structs by randomdata on Friday October 11, 2024 @09:58AM (#41809538)
Excel is the best first language if you just want a world full of computer programmers.

But there is an implicit context here around those who want to program alongside the professionals. That comes with wanting some deeper understanding of the machine.

Re:JavaScript Structs by n_plus_1_acc on Thursday October 10, 2024 @03:49PM (#41802790)
How can you teach C when there's no list of UB, there's sometimes no agreement on how to read the standard, and loads of non-standard-compliant compilers.
Re:JavaScript Structs by bobthepanda on Thursday October 10, 2024 @04:09PM (#41802990)
Plenty of universities teach C every day even if that means specifying a compiler, and usually it’s a very boring compiler that gets chosen
Re:JavaScript Structs by n_plus_1_acc on Saturday October 12, 2024 @05:13PM (#41822663)
Right, but all C courses I've done had UB in examples without mebtioning it. There teachers just didn't know what they are teaching.
Re:JavaScript Structs by bobthepanda on Monday October 14, 2024 @11:42AM (#41838578)
Unless you are writing a compiler and code specifically tailored to take advantage of UB, there’s not much to say about it other than “be careful about UB cause it can make your program buggy from your POV.”
Re:JavaScript Structs by lelanthran on Saturday October 12, 2024 @06:25AM (#41818074)
> How can you teach C when there's no list of UB, there's sometimes no agreement on how to read the standard, and loads of non-standard-compliant compilers.

Right. Becuase no one ever learned C as a first language ever, and those that paradoxically did were worse programmers for it!

Re:JavaScript Structs by n_plus_1_acc on Saturday October 12, 2024 @05:12PM (#41822656)
Are you saying people who learned C as their first programming language are better programmers or worse?
Re:JavaScript Structs by lelanthran on Tuesday October 15, 2024 @10:45AM (#41849167)
> Are you saying people who learned C as their first programming language are better programmers or worse?

That's both a false dichotomy and irrelevant as well.

My message is "There are multiple excellent (even legendary) developers in the short history of our field that learned programming in C. There are many more who primarily used C".

This refutes your point completely.

Re:JavaScript Structs by hombre_fatal on Thursday October 10, 2024 @04:53PM (#41803481)
The problem with C is that beginners generally want to build something.

"Oh, you want to build an app that does X? Well, first learn C for three months and then switch to Python/Javascript/etc. to build the thing that motivated you in the first place" doesn't fly.

Re:JavaScript Structs by GordonS on Thursday October 10, 2024 @05:37PM (#41803833)
Aye, especially nowadays with the ubiquity of computing - "hello world", or console apps in general, aren't the most enticing of projects anymore.
Re:JavaScript Structs by int_19h on Thursday October 10, 2024 @06:46PM (#41804351)
From that perspective, something like Pascal or Modula-2 is much better - you get all the same stuff but no footguns.
Re:JavaScript Structs by eddd-ddde on Thursday October 10, 2024 @10:05PM (#41805401)
Actually yeah, I'd say even something like zig would work but that's pushing it a little bit in terms of feature complexity.
Re:JavaScript Structs by jerf on Friday October 11, 2024 @09:21AM (#41809258)
I'm not saying this because I like Go per se, though one might argue I like Go because I can say this, but "Go, but stay away from all concurrency for a while" is becoming my go-to recommendation for new programmers. Fewer foot guns, it's close enough to the metal you can learn about it (there's even an assembler you can play with if you want to), and despite being 15 years old is essentially not the result of 15 years of language-construct-astronautics. It also lacks a lot of the accidental complexity of C in the compilers, using new modules is "go get" rather than essentially learning a new sublanguage, a lot of advantages.

But do stay away from the concurrency. I occasionally get flack on that point, but try to remember back to your programming days when you were having enough trouble keeping track of how one instruction pointer was flowing; it doesn't help to immediately try to keep track of multiple. Gotta recover the novice mindset for a moment when recommending programming langauges.

I used to recommend Python, as many others did. Your cited disadvantages of such languages are certainly true, but Python used to make up for it with the ability to do real work relatively quickly, and while it may not have taught you how the machine worked, it did a good job of teaching programming. But now... well... Python was my primary hobby language for about 8 years around 2000-2008. I'm fluent in Python. I wrote metaclasses. I wrote a bit of a C module. And I can still read it, because I do check in from time to time. But it's not the same language anymore, and almost every change it has made has made it harder to recommend as a new language. It used to be the simple alternative to Perl that still had most of the power... now I think it's harder to read than a lot of Perl 5, what with all the constructs and the rules about what happens and the difficulty of resolving what a given line is going to do with all the ways of overloading and decorating and overriding everything. And the culture of having all this power, but using it selectively, is gone from what I can see; now it's "we have all this power and what a shame it would be not to use it".