Skip to content

Conversation

@teo-tsirpanis
Copy link
Contributor

I noticed that static abstract members have started being used used in regular BCL code, and used them on two occasions.

@ghost ghost added the community-contribution Indicates that the PR has been added by a community member label May 12, 2022
@ghost
Copy link

ghost commented May 12, 2022

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is good to enforce specialized binding to the interface, but I removed it because there was no apparent reason (and didn't see it in the SslStream code I linked).

Copy link
Member

@jkotas jkotas May 13, 2022

Choose a reason for hiding this comment

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

Constraining generic arguments by structs can give hint to some of the AOT compilers that they do not need to bother to create code shared by reference instantiations.

Copy link
Member

Choose a reason for hiding this comment

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

Both T and THandler can be constrained as structs here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Copy link
Member

Choose a reason for hiding this comment

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

didn't see it in the SslStream code I linked

Maybe this can be done in the SslStream code too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are 21 places where TAdapter : IReadWriteAdapter is being used; it would go beyond this PR's scope, better for another time.

BTW can't the AOT compilers be smarter and detect that the shared instantiation will not be used? Or is it done intentionally (my guess would be for something like a fallback for reflection)?

Copy link
Member

Choose a reason for hiding this comment

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

Or is it done intentionally (my guess would be for something like a fallback for reflection)?

Correct. I believe that some of the AOT compilers that we have do this already ... but it is hard to do in general case due to reflection.

Copy link
Member

@stephentoub stephentoub left a comment

Choose a reason for hiding this comment

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

Thanks

@teo-tsirpanis teo-tsirpanis added the NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) label May 13, 2022
@teo-tsirpanis teo-tsirpanis force-pushed the static-abstract-members branch from 019bf31 to 812005f Compare May 13, 2022 15:48
@teo-tsirpanis
Copy link
Contributor Author

Feedback addressed @jkotas.

@teo-tsirpanis teo-tsirpanis removed the NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) label May 13, 2022
Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

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

Thanks!

@jkotas
Copy link
Member

jkotas commented May 13, 2022

From Build Analysis:

Known repository errors
Build product - #69190

@jkotas jkotas merged commit 20ded07 into dotnet:main May 13, 2022
@teo-tsirpanis teo-tsirpanis deleted the static-abstract-members branch May 13, 2022 20:28
@ghost ghost locked as resolved and limited conversation to collaborators Jun 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants