this post was submitted on 05 Oct 2024
103 points (94.8% liked)

Programming

17313 readers
556 users here now

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 [email protected]



founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 48 points 1 month ago (21 children)

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.

[–] [email protected] 11 points 1 month ago (19 children)

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.

[–] paperplane 1 points 1 month ago (1 children)

Swift fits the description too

[–] [email protected] 1 points 1 month ago (1 children)

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

[–] paperplane 2 points 1 month ago (1 children)

Swift does have data race safety as of Swift 6 with their actor-based concurrency model and are introducing noncopyable types/a more sophisticated ownership model over the next few releases

[–] [email protected] 1 points 1 month ago (1 children)

Hmm, that sounds quite interesting. But because I've had to rebut that for everyone else that responded: Is it opt-in?

I guess, I would be fine with opt-in for the actor pattern, since you either do actors in your whole codebase or you don't, but otherwise, opt-in often defeats the point of safety measures...

[–] paperplane 2 points 1 month ago

It's opt-in in Swift 5 mode and opt-out in Swift 6 mode, the Swift 6 compiler supports both modes though and lets you migrate a codebase on a module-by-module basis.

Agree that opt-in sort of defeats the point, but in practice it's a sort of unavoidable compromise (and similar to unsafe Rust there will always be escape hatches)

load more comments (17 replies)
load more comments (18 replies)