102
What are your favorite statically typed, compiled, memory safe programming languages?
(programming.dev)
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Follow the wormhole through a path of communities [email protected]
With no context, this could be an honest attempt to learn about different tools, a thinly veiled set-up to promote a specific language, or an attempt to stir up drama. I can't tell which.
It's curious how such specific conditions are embedded into the question with no explanation of why, yet "memory safe" is included among them without specifying what kind of memory safety.
Yeah, arguably the only answer to this question is Rust.
Java/C#/etc. are not fully compiled (you do have a compilation step, but then also an interpretation step). And while Java/C#/etc. are memory-safe in a single-threaded context, they're not in a multi-threaded context.
C# has native compilation capability, thanks to Native AOT
https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot/
I mean, yeah, valid point. JVM languages also have GraalVM for that purpose.
But I'm playing devil's advocate here. 🙃
Arguably these don't count, because they're not the normal way of using these languages. Reflection isn't properly supported in them, for example, so you may not be able to use certain libraries that you'd normally use.
These also still require a minimal runtime that's baked into the binary, to handle garbage collection and such.
Personally, I enjoy fully compiled languages, because they generally don't lock you into an ecosystem, i.e. you can use them to create a library which can be called from virtually any programming language, via the C ABI.
You cannot do that with a language that requires a (baked-in) runtime to run.
But yeah, obviously someone just specifying "compiled" probably won't have all these expectations...