Skip to content

Nim is unsafe #4

@dom96

Description

@dom96

...or at least that's what I am told by Reddit/HN.

It seems that this is Nim's reputation now, every single time a discussion about Nim gets off the ground somebody comes along and says something like "Nim would be awesome but it has the same unsafe and undefined behaviour as C". Recent example here. Somebody even asked a question on Quora about this: https://www.quora.com/Is-Nim-really-that-unsafe.

The root of this criticism is here.

I think it's about time we do something about this. Either simply decide that Nim doesn't try to be safe, does try to be safe but provides features which allow it to be unsafe, does try to be safe but a bug causes it to be unsafe, or a combination of those statements. So which is it?

Is it for example fine that

echo("Counting to ten: ")
for i in countup(1, 10):
  var k: ref int = nil
  var l = k[]
  echo($l)

Will not crash in release mode?

Possibly related: #2809

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions