-
Notifications
You must be signed in to change notification settings - Fork 174
Remove null argument checks and thrown ArgumentNullExceptions #657
Conversation
|
If the issue is one of code volume, would it be worth onboarding to .NET 5 and C# 9 at build-time, but using .NET Core 3.1 TFMs such as |
|
I haven't heard about that proposal. To be honest, I think that proposal is the wrong approach - I'm not thrilled about the idea of putting Even with all of the |
Fair enough, I just thought I'd ask in light of that feature being on track for C# 9.
If I recall, support for C# 8's nullability metadata is a major focus for F# 5, so as to address that precise issue (https://github.com/fsharp/fslang-design/blob/master/RFCs/FS-1060-nullable-reference-types.md). Perhaps with your recent improvements to use |
|
I could be wrong, but my understanding is that F# 5 will not include integration with C# nullable reference types, since the PR for that proposal is still open: dotnet/fsharp#6804. Maybe there is another PR that is in F# 5 that I'm not aware of though? |
|
Ah, got it; I think I'd seen it in early planning docs, but didn't realize it was deferred, sorry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been wanting this for a while now. Thanks!
With C#'s nullable reference types feature enabled in all projects, checking if every argument is null and throwing
ArgumentNullExceptionis not as important. Null values can still appear even with non-nullable types, especially with public members or when interacting with code that doesn't have nullable references types enabled, but it's much less likely now. We have decided that the benefit of catching nulls at runtime that should already be checked by the compiler is not worth the cost of decreased code readability, so they're being removed.