dotnet / csharpstandard

Working space for ECMA-TC49-TG2, the C# standard committee.
Creative Commons Attribution 4.0 International
706 stars 84 forks source link

Duplication on null conversion #1156

Open BillWagner opened 1 month ago

BillWagner commented 1 month ago

We repeat ourselves, and classify an expression such as object o = null in two different ways:

10.2.7 Null literal conversions

An implicit conversion exists from the null literal to any reference type or nullable value type.

10.2.8 Implicit reference conversions includes:

We should classify it as one or the other.

BillWagner commented 1 month ago

/cc @jcouv

Nigel-Ecma commented 1 month ago

This is a leftover over from wiping the null type. Back in v1 §9.4.4.6 defined the null-literal to have the null type, and §13.1.4 (now §10.2.8) said “From the null type to any reference-type”. So no double naming.

I expect the term “null literal conversion” is too well used now to be dropped, and also that the conversion should be mentioned along with other implicit reference conversions.

We could alternatively view null literal conversions as a subset of implicit reference conversions. Maybe start §10.2.8:

The implicit reference conversions include the null literal conversion (§10.2.7) and the following:

or better wordsmithing.