This commit is contained in:
Fredric Silberberg 2022-02-24 14:38:48 -08:00
Родитель d8857d19aa
Коммит f0af973fb5
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: EEEEFE2293400B4A
1 изменённых файлов: 3 добавлений и 3 удалений

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

@ -28,7 +28,7 @@ Matched constants can be subjected to a conversion today: for example, `obj is u
integer value. The result of this conversion, though, is itself a constant value. For `Span<char>`, this isn't the same. `spanValue is "Hello world"` needs to
convert `"Hello world"` to a `ReadonlySpan<char>`, the result of which is _not_ a constant value. It could be argued, therefore, that this should not be permitted,
and instead the scenario should wait for [active patterns](https://github.com/dotnet/csharplang/issues/1047). However, we think that this scenario is still morally
constant, even if not strictly semantically constant. We can additionally emit better code for the scenario that we currently think active patterns could, as it will
constant, even if not strictly semantically constant. We can additionally emit better code for the scenario than we currently think active patterns could, as it will
benefit from our existing optimizations around string comparisons.
##### Conclusion
@ -41,7 +41,7 @@ This question is around how we should specify the comparison: should we specific
by the framework, or should we have some kind of fallback ability?
In supported all distributions, `MemoryExtensions` and `Span`/`ReadonlySpan` have been either been directly in the framework together, or have been shipped as part
of the same NuGet package. So we don't think there are any places where `Span` would be present, but not the `SequenceEquals` method for comparison won't be.
of the same NuGet package. So we don't think there are any places where `Span` would be present, but the `SequenceEquals` method for comparison won't be.
Specifying in terms of `MemoryExtensions` is also much easier for the implementation: if we have some kind of fallback ability, then that code has to be implemented
and tested, all in service of a scenario that we think is extremely unlikely.
@ -90,7 +90,7 @@ Based on our discussion around `null` constants, we think the subsumption rules
being matched with `string` constants. We think that there are a couple of open questions for Utf8 strings and list patterns though:
1. Should Utf8 strings allow pattern matching as well?
2. Should `string` patterns contribute to subsumption in list patterns over that same value? For example, `stringValue is [] or ""` report an unreachable case?
2. Should `string` patterns contribute to subsumption in list patterns over that same value? For example, should `stringValue is [] or ""` report an unreachable case?
##### Conclusion