Hacker News new | past | comments | ask | show | jobs | submit login

> To be clear, swift is a big improvement over objC, but you can't pretend it's a VM managed language.

Memory safety does not require VM management (or so Rust is trying to prove).




>Memory safety does not require VM management (or so Rust is trying to prove).

I agree, with a few qualifications. I think Haskell has already proved it's possible.

I think Swift + ARC isn't a strong enough guarantee of memory safety for two reasons:

1) Swift has to interact with a huge amount of objC code, of varying degrees of quality (some Apple code, some OSS code via cocoapods). Swift itself would be much safer if all objC was rewritten in Swift.

2) ARC isn't as strong a guarantee as either GC or Rust's pointer semantics. For example, it's easy to hold weak references to something you thought was retained, and then dereference an invalid pointer.

So yes, you can have a memory safe language without a VM, but I think you need GC and/or much stronger pointer semantics, ala rust.


> I think Haskell has already proved it's possible.

Haskell has a GC, no?


Yes. GHC bundles a fairly heavy runtime with programs, including (but not limited to, not by a long shot) a garbage collector: https://ghc.haskell.org/trac/ghc/wiki/Commentary/Rts




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: