5 ms·
Also Java has Optional<T> and C# has Nullable<T>.
by davinic 7y ago
Also Java has Optional<T> and C# has Nullable<T>.
- LessDmesg 7y agoThat'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.
- howellnick 7y agoC# 8.0 introduced "Nullable Reference Types" (https://devblogs.microsoft.com/dotnet/embracing-nullable-reference-types/ https://devblogs.microsoft.com/dotnet/embracing-nullable-ref...), which, if enabled, can help solve this problem.
- deleted 7y ago[deleted]
- navaati 7y ago> was blindly copied over from C++. From C! AFAIK C++'s references can not be null!
- dep_b 7y agoThe 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.