fsharp / fslang-design

RFCs and docs related to the F# language design process, see https://github.com/fsharp/fslang-suggestions to submit ideas
512 stars 142 forks source link

Update FS-1060-nullable-reference-types.md #735

Closed dsyme closed 1 year ago

dsyme commented 1 year ago

We're looking at this again and after discussion with @vzarytovskii are looking more deeply at string | null as the syntax for nullable reference types.

We've concluded string? overly normalizes nullable reference types as the canonical representation of optionality in F#

charlesroddie commented 1 year ago

It's a mistake to add a new syntax, different from other dotnet languages, for a feature designed specifically for interop with other dotnet languages. Programmers will now need to know both syntaxes to use this feature.

The RFC now has a syntax designed to be a bit awkward, while it also has sugar (like match ... with null | x -> x.Method) designed to save programmers typing time when using the feature extensively. That's a bit inconsistent.

vzarytovskii commented 1 year ago

It's a mistake to add a new syntax, different from other dotnet languages, for a feature designed specifically for interop with other dotnet languages. Programmers will now need to know both syntaxes to use this feature.

The RFC now has a syntax designed to be a bit awkward, while it also has sugar (like match ... with null | x -> x.Method) designed to save programmers typing time when using the feature extensively. That's a bit inconsistent.

F# also interops with JS and TS, syntax fits with literal types and anonymous unions, which are under consideration.