by Pharohbot · 11y ago · 0 comments
With regards to memory safety, it is not. https://news.ycombinator.com/item?id=9050999 is an old comment from Patrick, but in today's Nim, it segfaults in both release and development modes for me. Rust's guaranteed memory safety means that Rust code (without explicit unsafe, the vast vast majority of code) cannot segfault.
> I don't understand why people think that Nim is "terribly unsafe" when in reality it's like any other language
For example, unless I write a bad cext, I cannot get Ruby to segfault.
None of this makes Nim a bad language. All languages have tradeoffs.
EDIT: Also, Nim is planning on turning those segfaults into runtime NilErrors and a nilChecks flag that will check for them at compile time, you can also avoid this by annotating Pointers with `not nil`
Because it isn't true.
"in my opinion I don't see it any less safe than languages that don't have automatic memory management"
Strawman ... the comment was about scripting languages.
"and/or languages like Rust"
Then it would be unwise to pay any attention to your opinion.
Did you not see the other person who just said that?
> Strawman ... the comment was about scripting languages.
I do not have a clue what you are trying to say...
Note: these unsafe features have two purposes. One is to interface with C/C++ code. The other is to be able to write close-to-the-metal code in Nim rather than in C (where you wouldn't gain any safety by using C, but lose the expressiveness of Nim). This is, for example, how Nim's GC is itself written in Nim.
None of the unsafe features are necessary for high-level programming, i.e. unless you actually want to operate that close to the metal.
That is factually false.
"Perhaps it's not as safe as Rust"
And there even you have contradicted yourself.
"Perhaps it's not as safe as Rust but that brings specific trade offs most people dont wan't to deal with."
That much is true ... and can be said without telling falsehoods, like your first statement.
"I don't understand why people think that Nim is "terribly unsafe" when in reality it's like any other language"
You are confused by your own strawman.