You are viewing a single thread.
View all comments
50 points

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.

permalink
report
reply
4 points

The question mine as well be “what is your favorite compiled language?”. There is a lot of overlap between the possible answers.

permalink
report
parent
reply
11 points

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.

permalink
report
parent
reply
4 points

How are they not memory safe in a multi-threadded context?

permalink
report
parent
reply
4 points

There’s nothing to prevent data races. I myself have fallen into the trap of using the same list from multiple threads.

permalink
report
parent
reply
8 points
*

C# has native compilation capability, thanks to Native AOT

https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot/

permalink
report
parent
reply
4 points

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…

permalink
report
parent
reply
5 points

Arguably modern c++ ( aka if you don’t use raw pointers), fits all categories.

permalink
report
parent
reply
2 points

I don’t know much about C++, but how would that do memory safety in a multi-threaded context? In Rust, that’s one of the things resolved by ownership/borrowing…

Or are you saying arguably, as in you could argue the definition of the categories to be less strict, allowing C++ as well as Java/C#/etc. to match it?

permalink
report
parent
reply
1 point

Modern C++ does use references, which can also reference memory that is no longer available. Avoiding raw pointers isn’t enough to be memory safe.

permalink
report
parent
reply
1 point

Swift fits the description too

permalink
report
parent
reply
1 point

Most people would consider it so, but it actually does not either fulfill the argument I posed there: https://forums.swift.org/t/what-language-is-more-memory-safe-swift-or-rust/31987

permalink
report
parent
reply
4 points

Yeah, I like subleq.

  • compiler is extremely fast, faster even than tinycc
  • strongly statically typed: all values are ints. Since it’s all of them, you don’t even need to write it!
  • memory safe: the entire (virtual) address space is guaranteed to be accessible at all times so there’s no way to leak any of it (can’t release it anyway) or to segfault (it’s all accessible).

Subleq is the obvious winner in my mind.

permalink
report
parent
reply

Programming

!programming@programming.dev

Create post

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

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you’re posting long videos try to add in some form of tldr for those who don’t want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



Community stats

  • 2.3K

    Monthly active users

  • 970

    Posts

  • 8.7K

    Comments