Add design notes for Oct 31, 2018 meeting

This commit is contained in:
Andy Gocke 2018-11-01 12:41:45 -07:00
Родитель ccf66131e0
Коммит 8f3bd70667
2 изменённых файлов: 87 добавлений и 4 удалений

Просмотреть файл

@ -0,0 +1,83 @@
# C# Design Review Notes for Oct 31, 2018
This was a review with the full design team (including Anders) to see how the
whole release is shaping out.
## Discussion
### Nullable
#### Flow analysis to turn a non-nullable type to nullable
The question is whether flow analysis can cause types to become nullable if a
value of non-nullable type is compared to null.
```C#
void M(string x)
{
if (x == null)
{
// is x now treated as string? here?
}
}
```
This is an issue that TypeScript has dealt with. There's some worry that most
of the warnings will be produced not at the place with the problem. We should
be careful that we're not going to annoy the user.
#### Flow analysis and refactoring
Flow analysis constrains refactoring because something may be tested null by
flow analysis, but if you pass to a new method, the flow analysis is lost. For
example:
```C#
class C
{
string? Prop1 { get; }
string? Prop2 { get; }
}
class C2
{
void M1(C c)
{
if (c.Prop1 != null && c.Prop2 != null)
{
M2(c);
}
}
void M2(C c)
{
// The null checking from M1 is lost here and M2 has to
// check again for null to avoid a warning
c.Prop1.Equals(...)
}
}
```
#### `!` on parameters
Very different behavior depending on where `!` appears -- maybe too many
meanings.
#### Treatment of lambdas
For
```C#
void M()
{
int? x = null;
Action a = () => x = 0;
a();
// What's the null state of `x` here?
}
```
Treating the delegate conversion as executing the method is unsafe, but
not doing so is conservative and will warn on valid checking. TypeScript
has also hit this and there's no easy answer.

Просмотреть файл

@ -197,16 +197,16 @@ Discussion of records proposals:
[C# Language Design Notes for Oct 29, 2018](LDM-2018-10-29.md)
### Agenda
- [Source-level opt-in to nullable reference types](https://github.com/dotnet/csharplang/issues/1939)
# Upcoming meetings
## Oct 31, 2018
[C# Language Design Notes for Oct 31, 2018](LDM-2018-10-31.md)
- *Design review*
# Upcoming meetings
## Nov 5, 2018
- Where can `#nullable` go? (Chuck, Fred)