Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reframe null value errors ch06-02-match.md #4177

Closed
wants to merge 1 commit into from

Conversation

gerwitz
Copy link

@gerwitz gerwitz commented Dec 22, 2024

This may be pedantic, but so is Rust!

As written, the prose conflates null value errors with Hoare's "billion dollar mistake". But as quoted earlier, that phrase applies to the creation of null values. What is described here is just one trap that his "mistake" enabled.

I have tried to re-phrase more accurately, but my interest is in correctness rather than my word choices.

Reframe null value errors
Copy link
Contributor

@chriskrycho chriskrycho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion, and I for one appreciate your pedantry (pedants unite! 😂)! However, in this case I think it’s okay as is—I checked exactly how the book frames it, and this is how Chapter 6 initially frames it:

I call it my billion-dollar mistake. At that time, I was designing the first comprehensive type system for references in an object-oriented language. My goal was to ensure that all use of references should be absolutely safe, with checking performed automatically by the compiler. But I couldn’t resist the temptation to put in a null reference, simply because it was so easy to implement. This has led to innumerable errors, vulnerabilities, and system crashes, which have probably caused a billion dollars of pain and damage in the last forty years.

The problem with null values is that if you try to use a null value as a not-null value, you’ll get an error of some kind. Because this null or not-null property is pervasive, it’s extremely easy to make this kind of error.

It is that latter bit this is referring to. In a void, we could of course rephrase it for maximum precision,1 but with this as the context, I think the existing phrasing is fine, and we’re trying to keep changes where it’s not strictly an error being corrected to a minimum because of the amount of work involved in print updates.

Again, though, thank you (earnestly!) for the pedantry. 😅

Footnotes

  1. Being maximally pedantic: having null references is fine if you must always check them and cannot have unchecked types in your system.

@chriskrycho chriskrycho closed this Jan 6, 2025
@gerwitz
Copy link
Author

gerwitz commented Jan 6, 2025

My pedantry would be offended, but I certainly understand having a high barrier to changes do to printing! Thanks for the thoughtful reply. 🫡

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants