3 ms·
Last I looked: - Nim had a lot of undefined behavior. Dereferencing a null pointer, for example, led to undefined behavior because of compiling to C. - Nim se
by pcwalton 11y ago
Last I looked:
- Nim had a lot of undefined behavior. Dereferencing a null pointer, for example, led to undefined behavior because of compiling to C.
- Nim seemed to have less flexible data race prevention (though the abstract interpretation stuff that Nim does to determine disjointness of arrays could be more ergonomic than Rust's split_at_mut, albeit more complex). Data races were also more of a problem in Nim because the lack of a thread-safe GC meant that races could result in use-after-free.
- Nim was in the typical "memory safety requires a GC; opt out of GC and you lose memory safety" category of languages (reference counting being a form of GC). Rust, by contrast, retains safety even when GC is not used (which it rarely is).
This was many months ago, so it may well have changed.
- kirbyfan64sos 11y agoIn most cases, though, the GC is light enough that it can stay enabled, and you'll rarely ever end up with raw pointers. For threading, you can use the capabilities at: http://nim-lang.org/docs/threadpool.html http://nim-lang.org/docs/threadpool.html
- pcwalton 11y agoThe GC was not thread-safe at that time, so you did not need raw pointers to get the unsafety.