3 ms·
Some people only know JS, or just don't want to learn both embedded and C at the same time. If projects like this can help people get over that initial hurdle,
by oddity 6y ago
Some people only know JS, or just don't want to learn both embedded and C at the same time. If projects like this can help people get over that initial hurdle, then all the better.
Plus, writing constrained environment language implementations is quite fun.
- mhh__ 6y agoI guess so. Directed at anyone asking the question your first paragraph raises: C isn't that bad, give it a try, even if you don't use it your skills and perspective as an engineer will thank you.
- colejohnson66 6y agoPointers are quite a hard concept for a lot of people to wrap their heads around. JavaScript’s lack of them is easier to understand for them.
- jakear 6y agoIn my experience the harder thing is the stack/heap memory model. It’s easy enough to get someone to understand that the variable “points” to another variable like a house address or whatever. But, trying to explain that once a return happens the thing that was pointed to will potentially be gone entirely and you probably wont know immediately, or at least until you call another function, unless you allocated it with malloc, but in that case you need to be sure to call free at some point later, but watch out don’t call free twice, and hey there’s some analysis tools you can use with gdb to help find these types of issues, oh yeah gdb is this debugger it has its own special syntax you’ll want to learn than too, etc etc etc. It’s so much easier to say: oh, you want to make a tree? Just make some leafy nodes and make some branchy ones point to them and you’ll literally never see segfault in your life. The pointers are still there, but the trouble is gone.
- nicoburns 6y agoC's point syntax doesn't help either. It's fine if you just have one pointer. But a few of them nested with some functions in the mix. Oh my. Oh, and basic primitives like arrays and strings in C are far more complex (and easier to get wrong) than pretty much every other language. And it doesn't have a built in map type at all!
- krapp 6y agoIf you can understand how 'this' works in javascript you can almost certainly understand pointers in C.
- andrew_ 6y agoI'm not so sure. I learned pointers via C++ years before I tackled JS. Though I suspect you mean that the comprehension is similarly difficult, the paradigms are quite different. Visualizing and mentally tracking `this` by scope is aided by the structure of JS (even though it can get hairy with `bind`). Pointers requires a different model of thinking, and it's not one that's native to many languages. I originally came up in the mid-90s with VB3 and it was quite a jump to C++.