logoalt Hacker News

veexx103 • today at 1:45 PM • 7 replies • view on HN

Is it feasible to create a new language by adding features to C

just as was done with C++?


Replies

pornel • today at 4:13 PM

It's not worth it. The value of C is in compatibility, availability of compilers, and familiarity.

As soon as you change anything in a breaking way, start requiring your own compiler/transpiler, or introduce new idioms, you end up losing the things that keep C alive.

Users of C either like it exactly the way it is, or have to use a specific C version due to a vendor dependency or compliance.

An upgraded C not approved by the standards body gives you yet another niche language that is not C, but is still burdened with its old flaws.

➕ show 2 replies
pjmlp • today at 2:19 PM

And Objective-C, yet somehow people reinvent them badly in C.

accelbred • today at 4:29 PM

I am working on a language that was C with extensions, transpiled to plain C, but the C syntax is kinda not great to work with (stuff like needing type tables and unbounded lookahead). At the point you clean up the syntax, you're not really C with extensions anymore.

lelanthran • today at 7:20 PM

Sure. After all, gcl and ecl compile to C source.

FullGarden_S • today at 4:15 PM

C3 might be it because C3 has full C ABI compatibility so unlike most modern C-like alternatives, it checks out.

ActorNightly • today at 8:03 PM

I mean you dont need to make a "language" at all, you can just write a librar for all the stuff you need. This stuff is just syntactic sugar.

For example, when I worked on writing embedded software for autopilots, we had 2 files, common.so and common.h that contained essentially a super robust typing framework. The way it worked is that you defined types through the provided functions at the beginning of your code, and all of the definitions were stored and checked at runtime at the beginning before the main execution loop took effect. So basically taking what a more robust language compiler would do and just moving that processing to the start of execution.

I use something similar for my local llm setup at home, where i can have my agent basically write tools for itself and when the tool fails, the error code makes it pretty easy for the agent to fix.

nikbackm • today at 2:19 PM

There are already plenty of such languages, Zig among others.

➕ show 2 replies