D
As others have said, Haskell and Rust are pretty great. A language that hasn’t been mentioned that I REALLY want to catch on, though, is Unison.
After months of no practice, I forget quite a lot of stuff about them, regardless of language; therefore, none
C on Morello (or any other capability machine).
C is memory safe if you program it well enough, so I guess C
every single language (except Vlang of course) is memory safe if you program it perfectly.
Very, very few humans are capable of doing that, especially with C.
C? Memory safe? HAHAHAHA
落ち着いてください
Every car has airbags if you drive well enough. Right?
You can still make stupid mistakes in Rust. It may make it harder to make the most common mistakes, but pretending the guardrails are prevent any type of mistake is asking for a problem to happen.
The only one pretending mistakes can’t happen is the person I replied to. Mistakes definitely can happen and no programming language is fool proof.
Continuing my car analogy, would you rather drive a car with airbags and seatbelts or one without them? Of course you can still have a fatal accident, but it’s nice to have safety features that make it as unlikely as possible.
Lol. The people downvoting your comment need to get good.
Gleam?
https://gleam.run/
Rust.
C++, with some Skill
/s
but seriously, I don’t know any language with a good, C/Cpp-like Syntax (so not Rust), with a good compiler (again not Rust). So I’m sticking to Cpp.
You should check out zig, its compiler can even be used for c/c++. If you have time to listen to an interview, this developer voices interview on zig explains some of the advantages of this: https://www.youtube.com/watch?v=5_oqWE9otaE&t=3970s
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.
How are they not memory safe in a multi-threadded context?
There’s nothing to prevent data races. I myself have fallen into the trap of using the same list from multiple threads.
I don’t think data races are generally considered a memory safety issue. And a lot of languages do not do much to prevent them but are still widely considered memory safe.
Yeah, that is why I prefixed that whole comment with “arguably”.
I feel like the definition of memory safety is currently evolving, because I do think data races should be considered a memory safety issue.
You’ve got a portion of memory and access to it can be done wrongly, if the programmer isn’t careful. That’s what memory safety is supposed to prevent.Rust prevents that by blocking you from passing a pointer for the same section of memory into different threads, unless you use a mutex or similar.
And because Rust sets a new safety standard, I feel like we’ll not refer to Java and such as “memory-safe” in twenty years, much like you wouldn’t call a car from the 90s particularly safe, even though it was at the time.
The question mine as well be “what is your favorite compiled language?”. There is a lot of overlap between the possible answers.
Rust
Julia
I wouldn’t consider Julia statically-typed; am I wrong?
It’s actually optionally-typed. But if you’re liberal with type annotations you can treat it as statically typed.
That is a very specific subset
Not that specific tbh, most newer native languages these days are compiled and memory safe (Rust, Swift, Go, Kotlin Native, etc)
Garbage collection is still allowed, and technically JIT languages are still compiled so it really isn’t that restrictive
Rust and Haskell (I think Haskell counts)
Python
They specified statically typed languages. Python would be dynamically typed
Python is dynamically typed by default, but lots of Python is statically typed.
No python is statically typed. You have type hints, which makes the language tolerable but like their name implies it’s a hint at the type. You can perfectly legally pass in something completely different that doesn’t conform whatsoever.
The primary thing static languages provide is static typing, that being the ability to determine before runtime that all the types are valid. A good example of this is how C++ programs will refuse to compile if you try to invoke a method that doesn’t exist on the type. That’s because it’s statically typed. At compile time you know that the code is wrong. Dynamic languages fundamentally don’t work like that. You cannot know until runtime if the method you called or the field you are trying to touch exists or not. Again type hints help a lot with this but that doesn’t change how the language actually operates.
Scala 3 native. If the compiler was faster I’d be even happier. Curious to try Ada