Null References: The Billion Dollar Mistake
1–10 of 158 posts
Re: Null References: The Billion Dollar Mistake
#2Re: Null References: The Billion Dollar Mistake
#3Re: Null References: The Billion Dollar Mistake
#4"Making everything a reference: The Billion Dollar Mistake" is the talk I want to see
Re: Null References: The Billion Dollar Mistake
#5This comes up again and again in one form or the other, yet new languages still seem to be making the same mistake. Of all languages I've touched, Rust seems to be the only one that mostly circumvents this problem. Are there other good examples?
Re: Null References: The Billion Dollar Mistake
#6"Making everything a reference: The Billion Dollar Mistake" is the talk I want to see
Re: Null References: The Billion Dollar Mistake
#7"Making everything a reference: The Billion Dollar Mistake" is the talk I want to see
Can you elaborate? I can't remember the last time I thought "oh darn it why is this a reference", but I can think of a billion problems I've had with nulls in jvm languages
Re: Null References: The Billion Dollar Mistake
#8This comes up again and again in one form or the other, yet new languages still seem to be making the same mistake. Of all languages I've touched, Rust seems to be the only one that mostly circumvents this problem. Are there other good examples?
Re: Null References: The Billion Dollar Mistake
#9This comes up again and again in one form or the other, yet new languages still seem to be making the same mistake. Of all languages I've touched, Rust seems to be the only one that mostly circumvents this problem. Are there other good examples?
Right now, a single sentinel value makes a pointer null or not null (0x0 is null, everything else is not null). This is exactly how you'd implement a stricter type, like "Maybe". Encoded as a 64-bit integer, "Nothing" would be represented as 0x00000000 and "Just foo" would be represented as 0xfoo. No object may be stored at the sentinel value, 0x00000000. Exactly the same as what we have now, and provides no assurances that 0xfoo is actually a valid object.
Meanwhile, Haskell which "doesn't have null" crashes for exactly the same reason your non-Haskell program crashes with a null pointer exception:
f :: Num a => Maybe a -> Maybe a
f (Just x) = Just (x + 41)
This blows up at runtime when you call f Nothing, because f Nothing is defined as "bottom", which crashes the program when evaluated.It's exactly the same as langages with null pointers:
func f(x *int) *int {
result := *x + 41
return &result
}
And the solution is the same, your linter or whatever has to tell you "hey maybe you should implement the Nothing case" or "hey maybe you should check the null pointer".Where I'm going with this is that you need to develop entirely new datatypes and have an even stricter type system than Haskell. Maybe Rust is doing this, but it's hard. We all know null is a problem, but calling null something else doesn't make the problems go away.
Re: Null References: The Billion Dollar Mistake
#10This comes up again and again in one form or the other, yet new languages still seem to be making the same mistake. Of all languages I've touched, Rust seems to be the only one that mostly circumvents this problem. Are there other good examples?
[1] https://docs.swift.org/swift-book/LanguageGuide/OptionalChai...