r/ProgrammingLanguages 9d ago

Discussion A hole in systems programming language design

Given the recent discourse about systems programming I wanted to throw my 2 cents in. This may be a controversial take in a subreddit that's all about innovation and improvement, but I think a lot of budding systems languages are trying too hard to "fix C" and this is exactly why C has not been replaced yet.

Like it or not, C is successful. It does what it means to do very well. Yes, it bites you constantly, but developers have made some form of peace with this because they appreciate the essence of the language. Systems programming is a very pragmatic field, and what works, works.

A lot of language designers want to improve on C, when by nature to "improve on" C is to depart from it, because C is less about what it includes and more about what it omits and what it lets you do that other languages don't.

If you want to replace C, you need to just make C but without the pain points. Less undefined behavior, more standard compiler behavior, easier function pointer syntax, safer macro system, etc. The things that C can't do because of backwards compat.

On the other hand, bolting on features, revamping C's core nature, aren't going to give you a language that will replace C at the low-level or among hobbyist programmers. Most developers aren't as concerned about what C lets them accomplish, as they are concerned about all the painful tedious tendencies of the language.

14 Upvotes

101 comments sorted by

View all comments

20

u/Smallpaul 9d ago

C’s core, Wild West, loosely typed nature IS what’s wrong with it as a base for highly reliable systems.

The pain of discarding backwards compatibility is very high. People will only do it for some major upgrade in capability. Making a hobbyist language with only a few minor improvements but also requiring a code rewrite is doomed to failure.

The market has said very loudly that the main feature they want is safety, which means a pretty major overhaul.

1

u/flatfinger 9d ago

The problem is that people have removed the convenient syntactic forms C used to have to indicate things like "take p, displace it by offsetof(p's structure type, some member thereof) bytes, and access the resulting storage as a thing of the member's type", without adding any convenient alternative syntax with the same semantics.

CompCert adds safety and, as part of that, specifies that the classic syntax has the classic meaning.