6 ms·
And how do you propose to get a simpler* language with equal control and safety? *I actually think Rust is relatively simple: once one "gets" ownership, then m
by dbaupp 13y ago
And how do you propose to get a simpler* language with equal control and safety?
*I actually think Rust is relatively simple: once one "gets" ownership, then most of the other hard things follow from it, including lifetimes.
- TylerE 13y agoLook at nimrod (http://www.nimrod-lang.org http://www.nimrod-lang.org).
- dbaupp 13y agoIt doesn't satisfy the safety or control criteria, e.g. it has a compulsory GC.
- pcwalton 13y agoNimrod is GC'd (reference counting is a GC, and DRC has pauses), or unsafe if you don't use GC. It's not in quite the same space as Rust.
- deleted 13y ago[deleted]
- girvo 13y agoI'm a massive Nimrod fan, but those safety guarantees are void once you use manual memory management. What Rust gives you is safety with memory management. Nimrods GC and type system are both really powerful, but Araq and I were chatting about Rusts type system on irc for a reason...
- TylerE 13y agoI'm probably in the minority here, but I think the answer is "so use a GC". The number of people on earth that I would trust with my life to correctly manage memory in a complex application is very small.
- pcwalton 13y ago> The number of people on earth that I would trust with my life to correctly manage memory in a complex application is very small. The Rust compiler checks it for you, so you don't have to trust anyone. :)
- tel 13y agoWhat kind of guarantees does the type system provide? Can I say that no terminating/productive Rust program leaks memory, full stop?
- kibwen 13y agoRust's type system statically guarantees that memory will never be accessed after it is freed, so no segfaults, no use-after-frees, no double-frees, no iterator invalidation, etc. It also statically eliminates data races between concurrent tasks. In the past Rust has attempted to use the type system to prevent memory leaks in certain cases, but the features that attempted to do so were deemed overly restrictive to use for practical purposes. Nowadays I'm sure it's possible to leak memory if you try. Honestly I've never heard of a Turing-complete language whose type system can provide such a guarantee.
- pcwalton 13y ago> Honestly I've never heard of a Turing-complete language whose type system can provide such a guarantee. SPARK (a dialect of Ada) can, I believe. But it does so by forbidding allocation :)
- haberman 13y agoDoesn't it make a stronger guarantee, that you cannot cause an invalid dereference? In addition to what you mentioned, this would also cover bounds-checking, trying to dereference a pointer that was never allocated, etc. Also does it enforce that memory is consistently used as a single type? Can you allocate a byte array and then cast it to an appropriately sized array of integers?
- zzzcpan 13y ago> And how do you propose to get a simpler* > language with equal control and safety? Easy - write your own compiler! :)