News for hackers. Stuff that matters.
Re:The general value of typed functional programming lies in... by justAnotherNET on Monday February 24, 2020 @12:48PM (#22406347)
Swift has this as well, but calls them “Optional”. The concept is definitely useful!
Re:The general value of typed functional programming lies in... by davinic on Monday February 24, 2020 @01:11PM (#22406596)
Also Java has Optional<T> and C# has Nullable<T>.
Re:The general value of typed functional programming lies in... by LessDmesg on Monday February 24, 2020 @01:30PM (#22406828)
That's not important in practice. What's important is that null infects all reference types in Java and C#, whether you asked for it or not. Just today I've spent a half an hour looking for a null dereference error - which the type system should've warned me of but didn't. The sad fact is, neither Java nor C# are fixable, because no new feature will fix the broken, null-unsafe code already written. All because of this billion dollar mistake that should've had no place in a GCed language but was blindly copied over from C++. The sooner Java gives way to Kotlin and completely fades into obscurity, the better.
Re:The general value of typed functional programming lies in... by howellnick on Monday February 24, 2020 @01:51PM (#22407082)
C# 8.0 introduced "Nullable Reference Types" (https://devblogs.microsoft.com/dotnet/embracing-nullable-ref...), which, if enabled, can help solve this problem.
Re:The general value of typed functional programming lies in... by navaati on Monday February 24, 2020 @02:41PM (#22407607)
> was blindly copied over from C++.

From C! AFAIK C++'s references can not be null!

Re:The general value of typed functional programming lies in... by dep_b on Tuesday February 25, 2020 @04:56AM (#22412012)
The big difference is that nullability is the standard in Java and C# while in Swift it's the other way round, it's non-nullable unless you clearly indicate it's not.