C++, Java, Rust are far from minimal. Go feels minimal but it too has a lot of features compared to C and it has a garbage collector too.
Here are some things I am looking for:
* Compiles down to machine code.
* Does not have the footguns of C.
* Simple like C.
* Implementations available for all major OSes, at least, Linux, Mac, Windows, *BSDs.
After extensive search I got the feeling that it is difficult to find such a language. If I am willing to let go "simple like C", then it provides a lot of options like Rust, Nim, and all. Just asking here to see if I missed something during my search.
> Simple like C.
You have to pick one, or give in on both and find a happy medium between the two. The way you get safety in a language is by abstracting over the simplicity.
I personally would suggest biting the bullet and going with C++, you can stick to a reasonably sane subset of the language but it definitely won't be C.
Yes it has GC. What is it that you want to build though? Will GC be in the way? If so, I would consider Rust instead.
C is simple, true – but in many cases it seems like that fact pushes the complexity up to higher layers instead.
C still has it’s place in embedded. And our best kernels are currently written in C. Outside of those domains I don’t see much reasons to start a greenfield project in C.
Zig sounds mostly like what you want, though: https://ziglang.org/
Possibly a subset of D could work, too:
https://dlang.org/blog/2018/06/11/dasbetterc-converting-make...
But likely the D language will be too big?
Each one has its own way in which it deviates from C in a way that some people might not like. Odin is probably a lot closer to C than Zig. Zig tries to bring some of the more recent ideas into the low level programming space (compile time null checking, builtin "T or error" types, etc.
Of course there are some other contenders, but having looked at them, either they are not even serious enough, or they deviate from C way too much, with GC, closures, etc.
V isn't anywhere near finish. The closest thing should be Zig. But that is far from finish as well.
Crystal is more like Go than C. But I mean someone wrote a OS [1] using Crystal in her spare time.
Or just plan old Pascal.
I mean if you are looking for simplicity like C and compiled to machine code you virtually ruled out 95% of all programming languages. Other languages like Lua is simple. But certainly dont fit the bill.
This doesn't seem like a satisfiable set of constraints. I'd recommend removing "not garbage collected" from the constraints, as automatic memory management mostly got introduced to reduce footguns.
Strings are memory managed for you, and can even include nulls.
See the Free Pascal project[1], and the Lazarus IDE[2]
My web servers run with like 300MB of RAM and work fine on t2.nano serving thousands of users??
And also Java gives you full access to primitive types if you don't like OOP
And sticking to some common heuristics goes a long way towards safety. Some people think it's impossible to write safe C, but you can.
So the answer is C.
C + smart pointers and container types?