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

Champion "ref extension methods on structs" (C# 7.2) #186

Open
gafter opened this Issue Feb 26, 2017 · 4 comments

Comments

Projects
None yet
6 participants
@gafter
Member

gafter commented Feb 26, 2017

  • Proposal added
  • Discussed in LDM
  • Decision in LDM
  • Finalized (done, rejected, inactive)
  • Spec'ed

See also dotnet/roslyn#165

@gafter gafter added this to the 7.2 candidate milestone Feb 26, 2017

@Thaina

This comment has been minimized.

Show comment
Hide comment
@Thaina

Thaina Feb 27, 2017

Very important feature

Thaina commented Feb 27, 2017

Very important feature

@benaadams

This comment has been minimized.

Show comment
Hide comment
@benaadams

benaadams Feb 27, 2017

Precedent in VB.NET. Should be compatible? (Currently C# can't see VB.NET's byref extension methods)

Also should work with ref returns; which enables low cost fluent or functional struct apis

benaadams commented Feb 27, 2017

Precedent in VB.NET. Should be compatible? (Currently C# can't see VB.NET's byref extension methods)

Also should work with ref returns; which enables low cost fluent or functional struct apis

@orthoxerox

This comment has been minimized.

Show comment
Hide comment
@orthoxerox

orthoxerox Mar 16, 2017

See also #128 (ref operators (on structs))

orthoxerox commented Mar 16, 2017

See also #128 (ref operators (on structs))

@alrz

This comment has been minimized.

Show comment
Hide comment
@alrz

alrz Jun 22, 2017

Contributor

What happens if we have two overloads,

void Deconstruct<T, U>(in this KeyValuePair<T, U> k, out T key, out U value) { .. }
void Deconstruct<T, U>(this KeyValuePair<T, U> k, out T key, out U value) { .. }

I think this should be possible to provide a ref variant without breaking existing code and the compiler should prefer the first overload afterwards.

Contributor

alrz commented Jun 22, 2017

What happens if we have two overloads,

void Deconstruct<T, U>(in this KeyValuePair<T, U> k, out T key, out U value) { .. }
void Deconstruct<T, U>(this KeyValuePair<T, U> k, out T key, out U value) { .. }

I think this should be possible to provide a ref variant without breaking existing code and the compiler should prefer the first overload afterwards.

@gafter gafter changed the title from Champion "ref extension methods on structs" to Champion "ref extension methods on structs" (C# 7.2) Sep 23, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment