4 ms·
You're hung up on words. I know they made it. It was based of Ken Thomson's B. They chose it, when they could have taken some other existing language. I see gre
by nec4b 5y ago
You're hung up on words. I know they made it. It was based of Ken Thomson's B. They chose it, when they could have taken some other existing language.
I see great beauty and simplicity in C the same way I see it e.g. in Lisp or Javascript for that matter. I dabbled in Modula-2 and it does not offer the same feeling in my opinion. The core features of C are very powerful and simple at the same time, which is the reason it stayed popular. People writing low level code understand that.
- int_19h 5y agoThe core features of Modula-2 are largely the same as C + modules, but with more consistent syntax and fewer footguns (like no unsafe implicit pointer conversions), so I don't see how C can objectively possess "great beauty and simplicity" in comparison. Unless you're referring specifically to the syntax? B was also written as a hack - it was basically a minimal subset of BCPL small enough to fit in the memory of the machines they were working with. B is elegant in a sense that it's a very simple language for a word-oriented architecture - but that's exactly the part that they had to get rid of for C to target byte-oriented ones. Coincidentally, it's also one of the sources of weirdness in C syntax (e.g. implicit int and K&R prototypes are all legacy of B).
- nec4b 5y agoClaiming something is not beautiful because it is "hacky" on HN is a bit unexpected. For me this is beautiful: https://briancallahan.net/blog/20220220.html https://briancallahan.net/blog/20220220.html I'm sure it's just a hack to you, but you can't do that in Pascal. I mostly like C because of what I wrote here: https://news.ycombinator.com/item?id=30404529 https://news.ycombinator.com/item?id=30404529
- int_19h 5y ago"Hacked together" can mean different things. In this case, it means something slapped together on short notice with limited resources. Such things rarely tend to be beautiful. Beautiful hacks absolutely exist, but they are never hacked together in this sense. The only thing your blog post demonstrates is that C has a built-in textual macro facility. But if you wanted the same in Pascal, you could have it just the same, by running it through the C preprocessor; or better yet, something more powerful like M4. Of course, you'd have to deal with various impedance mismatches, such as the fact that the definition of "token" is different between the preprocessor and the compiler - but that's also true of C! In fact, this discrepancy alone is quite sufficient to deem C inelegant, in my opinion.