Hacker News new | ask | show | jobs
by nerdymanchild 2998 days ago
I love C++ I just wish there was some sort of way to make it memory safe. At the same time the Java stack is too heavyweight for the things I use C++ for. If there werr some sort of memory safe language with the same use cases as C++ that would be game changing.
4 comments

Personally i have 3 axis for problems programming languages might be suitable for, as theres no such a thing as 'one language to rule them all' (And the 'Java cult' really made us all lost a lot of time trying to make things fit into this wrong mentality).

1 - For hardcore stuff - C++/Rust(if i can) - VM, OS, Browser, Emulator, etc..

2 - For bussiness/application/backend stuff - Swift (Go is also suitable but only if its server backend stuff, it will suck in other problem domains)

3 - for Scripting - Javascript/Lua (or Python). (This axis is expendable, as you may or may not use it)

So, from my point of view, you can also use Swift or Rust for some things, depending on the type and goal of the project, given both are memory safe and pretty fast.

You will never find 'the one true language', where you can use it for everything, so dont even loose your time trying to find it.

But for me, if theres something today that is much more closer to this goal is Swift.

Because it can cover a lot of ground. In my opinion, Rust can't do it, because given they were busy trying to eat C++ lunch in the language evolution process, they lost ergonomics and in the productivity area (you can use it of course, but you will suffer the same as if you had used C++ for the same problem domains).

Now maybe Swift will loose the Ref-counting by default runtime memory management, and if that happens, it can also be a great contender for things right now only C, C++ and Rust are suitable for.

For those that "love C++" (or their existing C++ code base), there's SaferCPlusPlus[1].

[1] shameless plug: https://github.com/duneroadrunner/SaferCPlusPlus

C++ core guidelines combined with the guidelines support library get you most of the way there.
Swift, Go, Rust, etc, all fit your description.

edit: De-Germaning

What's usw?

There are use cases for C++ that Swift and Go don't fit, due to having dynamically managed memory.

Fans of D would also put D on this list. And Ada is not dead yet!

“usw” is a common German abbreviation that means “etc.”