3 ms·
One of Rust's primary design goals is safety. This is the source of most of its differences from both Go[1] and C++. Nullable pointers, free pointers, and share
by lmkg 15y ago
One of Rust's primary design goals is safety. This is the source of most of its differences from both Go[1] and C++. Nullable pointers, free pointers, and shared mutable state are common sources of bugs and programmer errors in languages that have those features. Rust tries to address those issues by requiring the program to be explicit about handling such features. E.g., only pointers marked as nullable can have null value, and you are not allowed to dereference such pointers without a null check. This is the so-called "Bondage and Discipline" approach. There are pros and cons to this approach; the main arguments in favor of it revolve around the concepts of design-by-contract, and being able to enforce that contract, which lets you code less defensively.
[1] I get the feeling that Go's main design goal is ease of use, on par with Python.