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

Update function pointer proposal with LDM changes #2923

Merged
merged 2 commits into from
Nov 18, 2019

Conversation

333fred
Copy link
Member

@333fred 333fred commented Nov 1, 2019

No description provided.

@333fred 333fred force-pushed the new-func-ptr-syntax branch from be0e31a to e2f485c Compare November 1, 2019 20:45
Copy link
Member

@Perksey Perksey left a comment

Choose a reason for hiding this comment

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

Slight comment as someone who isn't cool enough to work at Microsoft :P

proposals/function-pointers.md Show resolved Hide resolved
@333fred
Copy link
Member Author

333fred commented Nov 11, 2019

@gafter @MadsTorgersen @stephentoub @jkotas, did you have any comments?

work though as a `mod_req` cannot bind to a `TypeSpec` and hence cannot target generic instantiations.

### Named function pointers

The function pointer syntax can be cumbersome, particularly in complex cases like nested function pointers. Rather than
Copy link
Member

@gafter gafter Nov 11, 2019

Choose a reason for hiding this comment

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

The [](start = 0, length = 3)

Please say something to make it clear that this is an alternative to, and not part of, the spec. #Resolved

Copy link
Member Author

@333fred 333fred Nov 12, 2019

Choose a reason for hiding this comment

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

This is in a bigger section titled Considerations, with a bunch of different future proposals.


In reply to: 344939001 [](ancestors = 344939001)

@333fred
Copy link
Member Author

333fred commented Nov 12, 2019

@gafter for your comments, I agree that we need to nail down the concepts of conversion for method groups in function pointers, but I think that's out of scope for this PR. I'm just updating the syntax here, so I'm going to resolve your comments and come back to them at a later time.

- A `func*` parameter cannot be marked as `params`
- A `func*` type has all of the restrictions of a normal pointer type.

- Custom attributes cannot be applied to a `delegate*` or any of its elements.
Copy link
Member

Choose a reason for hiding this comment

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

Custom attributes can't be applied today but we will likely want the ability to expose them in the future (to support GCSuppressTransition, other calling convention designations, etc).

Presumably, the compiler is currently planning on emitting these types directly as FNPTR type signatures. However, the runtime doesn't currently have any way to attach attributes to such type signatures.

Has this been taken into consideration since that would make it a breaking change to go from the inline function pointer syntax (the only thing available today) to change to some syntax that allows attributes?

CC. @333fred, @gafter, @jkotas

Copy link
Member

Choose a reason for hiding this comment

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

Custom attributes can't be applied today but we will likely want the ability to expose them in the future

Is there a design stating how such support would be implemented in the runtime?

Has this been taken into consideration since that would make it a breaking change to go from the inline function pointer syntax (the only thing available today) to change to some syntax that allows attributes?

No it hasn't because the underlying runtime support for this does not exist and would likely require changes to calli or the method in which the signature is provided to calli. Can't really take it into consideration if we don't know how the feature would be implemented in the runtime.

Copy link
Member

Choose a reason for hiding this comment

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

Asked someone from the runtime team to comment on the relevant issue: dotnet/roslyn#39865 (comment)

Copy link
Member

@gafter gafter left a comment

Choose a reason for hiding this comment

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

:shipit:

@333fred
Copy link
Member Author

333fred commented Nov 18, 2019

Filed dotnet/roslyn#39865 to track the open questions raised in this pr.

@333fred 333fred merged commit 08e94b3 into dotnet:master Nov 18, 2019
@333fred 333fred deleted the new-func-ptr-syntax branch November 18, 2019 17:44
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.

7 participants