-
Notifications
You must be signed in to change notification settings - Fork 92
[Version 9.0] Feature support for attributes on local functions #1466
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
base: draft-v9
Are you sure you want to change the base?
Conversation
e32a191 to
4184054
Compare
0fc9ff9 to
8b61c71
Compare
|
I reviewed the existing edits, made a couple small wording changes. This is ready for committee review for V9. |
| For invocations that occur within declarations of instance constructors, static constructors, finalizers and operators the member name used is implementation-dependent. | ||
| For an invocation that occurs within a local function, the name of the member method that calls that local function is used. Consider the following: if member method `M` calls local function `F1`, which in turn calls local function `F2`, and `F2` has a parameter marked with this attribute, the method name passed to `F2` is `M`, because a local function is *not* a function member! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should separate out the normative and informative here (and remove the exclamation mark preferrably...) Showing this as actual example code would be useful too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed! My original PR (#994) had a version of this text in an example, but that appears to have been lost. I'll work with Bill to restore it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is resolved by PR #1548.
| A static local function may be made conditional in the same sense as a conditional method ([§23.5.3.2](attributes.md#23532-conditional-methods)). | ||
| A compile time error ocurrs if a non-static local function is made conditional. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm interested in why this is the case - and maybe readers would be too?
| #### 23.5.3.1 General | ||
| The attribute `Conditional` enables the definition of ***conditional method***s and ***conditional attribute class***es. | ||
| The attribute `Conditional` enables the definition of ***conditional methods***, ***conditional local function***s, and ***conditional attribute class***es. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the original style continues to be followed with the last two items:
| The attribute `Conditional` enables the definition of ***conditional methods***, ***conditional local function***s, and ***conditional attribute class***es. | |
| The attribute `Conditional` enables the definition of ***conditional method***s, ***conditional local function***s, and ***conditional attribute class***es. |
| A static local function may be made conditional in the same sense as a conditional method ([§23.5.3.2](attributes.md#23532-conditional-methods)). | ||
| A compile time error ocurrs if a non-static local function is made conditional. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| A compile time error ocurrs if a non-static local function is made conditional. | |
| A compile time error occurs if a non-static local function is made conditional. |
| For invocations that occur within declarations of instance constructors, static constructors, finalizers and operators the member name used is implementation-dependent. | ||
| For an invocation that occurs within a local function, the name of the member method that calls that local function is used. Consider the following: if member method `M` calls local function `F1`, which in turn calls local function `F2`, and `F2` has a parameter marked with this attribute, the method name passed to `F2` is `M`, because a local function is *not* a function member! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lambdas and anonymous methods are in the same boat as local functions.
Add support for attributes and extern on local functions fix md formatting
This is now ready for committee review.
8b61c71 to
6006520
Compare
Update the C# standard for the feature of applying attributes on local functions.
Note that this also includes specifying
externon a static local function.This contains all commits from #994. Subsequent edits also made.