a thoughtful web.
Good ideas and conversation. No ads, no tracking.   Login or Take a Tour!
comment by user-inactivated
user-inactivated  ·  4327 days ago  ·  link  ·    ·  parent  ·  post: Follow up to "The Unreasonable Effectiveness of C"

Why is it so hard to make a replacement for C?





forwardslash  ·  4327 days ago  ·  link  ·  

I imagine the part of it is simply due to the sheer amount of time that has gone into the development of C over the years.

briandmyers  ·  4327 days ago  ·  link  ·  

Why exactly do you wish to replace it?

user-inactivated  ·  4327 days ago  ·  link  ·  

Well, I feel like it would do the software industry some good if there was a low-level language that was still very high level (in that it has high-level abstractions) with C speed (or faster) and C portability. I dunno. I'm also fascinated by how nothing's managed to come along after all this time and pushed C off its throne.

Aren't building and using new abstractions what programming is all about? Why not have new abstractions in a low-level setting?

briandmyers  ·  4326 days ago  ·  link  ·  

Someday I'd like to delve into Forth for an embedded project, for exactly these reasons.

user-inactivated  ·  4326 days ago  ·  link  ·  

Why forth?

briandmyers  ·  4326 days ago  ·  link  ·  

I've only read a little about it but it seems very object oriented, and a bit like Lisp for hardware. A different approach but a big learning curve.

user-inactivated  ·  4326 days ago  ·  link  ·  

What I don't get is how to structure your programs in forth. In C, it's natural with control flow and functions, but in forth, everything's a function, so it can all be written in one line...

user-inactivated  ·  4326 days ago  ·  link  ·  

hmmm, didn't know it was an oop, thought it was just functional composition and nothing else.

briandmyers  ·  4326 days ago  ·  link  ·  

Yes, exactly. As I said I only know a little about it, but it seems like you use Forth to design a language which matches (and controls) your machine. As you sometimes use Lisp to build other languages.

user-inactivated  ·  4326 days ago  ·  link  ·  

but how would that make it oop? that would just mean that it sorta enables metaprogramming.

briandmyers  ·  4326 days ago  ·  link  ·  

Now that you mention it, I think I've gotten my wires cross about the object-orientation angle; I think i was thinking of Smalltalk. It's another language that I've also thought would be interesting to learn, sometime. I really don't know a lot about either of them, though.

joelg236  ·  4327 days ago  ·  link  ·  

It's probably very possible, just insanely hard to make it faster than C itself.

user-inactivated  ·  4327 days ago  ·  link  ·  

why? what is it about C that makes it so fast?

joelg236  ·  4327 days ago  ·  link  ·  

It's written at such a low level that only a radically new idea on how to compile code could make it more efficient. *well, at least noticeably more efficient.

wildptr  ·  4327 days ago  ·  link  ·  

Also note that giving the programmer control over memory allocation speeds up things if you're good at it.

user-inactivated  ·  4327 days ago  ·  link  ·  

aren't there other languages with manual memory management?

wildptr  ·  4327 days ago  ·  link  ·  

Of course, but C has a big following behind it that won't go away without a fight. C won't disappear any time soon. Of course, that's just me being a pessimist.

briandmyers  ·  4327 days ago  ·  link  ·  

There's nothing wrong with using the right tool for the right job. C will live a long long time, because you don't need more than C to do whatever you need to do, on an embedded processor. For other work, PC and browser apps, whatever, other languages do better. Personally, I like what I've seen of python; but C is my bread and butter, because it does all I need it to do, and very well.

briandmyers  ·  4327 days ago  ·  link  ·  

C is old enough and simple enough to be, pretty much, well-defined. That helps compiler makers a lot.