4 ms·
Great! Thing is, Rust and Nim are very different. Just as I wouldn't put Rust down for not having GC (I love languages moving the art forward) I just wish we co
by gokr 11y ago
Great! Thing is, Rust and Nim are very different. Just as I wouldn't put Rust down for not having GC (I love languages moving the art forward) I just wish we could look at Nim as a language with different design goals than Rust. I know several things in Nim worth discussing, it doesn't have to be warring.
- masklinn 11y ago> I just wish we could look at Nim as a language with different design goals than Rust. Claims that Nim is memory-safe when it's not is not a difference of design goal though.
- gokr 11y agoSee my comment https://news.ycombinator.com/item?id=10992077 https://news.ycombinator.com/item?id=10992077 It seems to me that a) Nim is (or at least is meant to be, but bugs can sidestep it) memory safe if you stay within the rules for it, and b) Nim is not throwing around vague claims of safety that are not documented in the language manual.
- masklinn 11y ago> It seems to me that a) Nim is (or at least is meant to be, but bugs can sidestep it) memory safe if you stay within the rules for it That's completely worthless. C is also memory-safe if you stay within the rules for memory safety. > Nim is not throwing around vague claims of safety that are not documented in the language manual. Of course not since nim is not posting on HN (as it's not a sentient being prone to procrastination) it's obviously nim supporters making claims about nim's safety.
- gokr 11y agoIMHO it's not worthless. Nim has ptr and addr, but they are explicitly described as unsafe and only used "when you have to", like interfacing with C/C++ etc. I have never used them outside of C/C++ integration. Rust also has unsafe, but I presume you don't think that invalidates safety.
- ben0x539 11y ago> That's completely worthless. C is also memory-safe if you stay within the rules for memory safety. It's really not any weaker of a guarantee than Rust makes, being memory-safe if you stay within the rules of not saying `unsafe`. Or opening /proc/self/mem for writing, anyway. I'd also feel a lot better about Rust's moral highground of memory safety if its undefined behavior was actually spelled out a bit more rather than just punting the hard parts to llvm docs. I don't think every Rust user knows how to avoid aliasing problems between `&mut` and `*mut` either.
- pcwalton 11y agoWell, I think there's a very big practical difference between being unsafe in general and unsafe only within clearly delimited boundaries (that you can forbid with a lint). The latter is pretty much necessary for any language other than strictly sandboxed ones like JavaScript, while the former is something I think all languages in 2016 should take as sacrosanct from the get-go. (We've been trying and failing for about 45 years to prove that programmers will avoid making the same basic memory management mistakes if they're just trained better; I think it's well past time to give up and delegate these checks to the machine.) That said, I don't agree with the claim that Nim is less safe than Rust because Nim uses "ptr" types and Rust uses "unsafe" blocks to mark unsafe regions. I prefer Rust's approach, but it's pretty much just a question of UI, not anything substantive.
- pcwalton 11y agoEven with the threading/memory management issues fixed by enforcing shared-nothing, Nim isn't memory safe unless the undefined behavior issues that come from compiling to C (for example, dereferencing a null pointer) are sorted out. As I understand things, though, solving them is a work in progress.