Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collection expressions: better conversion from element #8338

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

cston
Copy link
Member

@cston cston commented Aug 6, 2024

Update better conversion from expression to prefer the target with the better conversion from each element.

See LDM-2024-07-24

@cston cston requested review from jaredpar and 333fred August 6, 2024 21:45
Comment on lines +24 to +25
> * `T₁` is `System.ReadOnlySpan<E₁>`, and `T₂` is `System.Span<E₂>`, and an ~~implicit~~ **identity** conversion exists from `E₁` to `E₂`
> * `T₁` is `System.ReadOnlySpan<E₁>` or `System.Span<E₁>`, and `T₂` is an *array_or_array_interface* with *element type* `E₂`, and an ~~implicit~~ **identity** conversion exists from `E₁` to `E₂`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mentioned this offline as well, but I'm not a fan of this change. Between ReadOnlySpan<string> and Span<object>, it feels like ReadOnlySpan<string> is clearly the better choice for a collection expression. Particularly since between ReadOnlySpan<object> and ReadOnlySpan<string>, the rule we're adding would make that unambiguous.

Think the next step here is to collect various examples of what we want to enable, vs what harm we think will come from leaving this overly broad. For example, the ReadOnlySpan<byte> vs Span<int> question.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants