News for hackers. Stuff that matters.
Re:Null References: The Billion Dollar Mistake – Tony Hoare ... by Sharlin on Monday May 30, 2016 @04:37AM (#11800282)
Currently in some (well, unfortunately many) languages. C++ references have always been non-nullable, and in Scala the only way you should get nulls is from Java libraries.
Re:Null References: The Billion Dollar Mistake – Tony Hoare ... by asQuirreL on Monday May 30, 2016 @04:49AM (#11800320)
Parent means something closer to pointers (in C++) when they say "reference type". In other words, if a type contains null, then we must always check locally that values of that type are not null before it is safe to use them (or manually maintain contracts).

With option types, we check whether it is empty once, and if it is not, we unwrap it and use it as if it were never nullable. Any function that uses the unwrapped value downstream is oblivious to the fact.

Re:Null References: The Billion Dollar Mistake – Tony Hoare ... by adrianratnapala on Monday May 30, 2016 @05:02AM (#11800353)
C++ references can easily be null (T& foo = *ptr_i_thought_was_good;).

But they provide a useful social convention: if it is a pointer then it is your job to check for NULL. If it is a reference, then it is the job of the other guy to ensure it is not null. And the rules of the language mean that null references (as opposed to pointers) are rare.

Re:Null References: The Billion Dollar Mistake – Tony Hoare ... by shultays on Monday May 30, 2016 @05:19AM (#11800414)
Not without an UB
Re:Null References: The Billion Dollar Mistake – Tony Hoare ... by adrianratnapala on Friday June 03, 2016 @05:49PM (#11833521)
So in other words my comment should have said that: in C++ it is easy to create something that is either a null-reference or some other, much more unpredictable, undefined thing.

Well then! That just goes to show how much safer C++ references are than I had previously supposed.

Re:Null References: The Billion Dollar Mistake – Tony Hoare ... by ArkyBeagle on Monday May 30, 2016 @09:48AM (#11801316)
If you never dereference a null pointer, then there will be no UB of that type.
Re:Null References: The Billion Dollar Mistake – Tony Hoare ... by shultays on Monday May 30, 2016 @10:10AM (#11801418)
I guess it counts as dereferencing. Here is what standard says

"A reference shall be initialized to refer to a valid object or function. Note: in particular, a null reference cannot exist in a well-defined program, because the only way to create such a reference would be to bind it to the “object” obtained by dereferencing a null pointer, which causes undefined behavior"