Repository navigation
[Version 9.0] Feature support for Static anonymous functions - #1461
Conversation
7133dbb to
69a8d66
Compare
|
|
||
| A non-`static` local function or non-`static` anonymous function can capture state from an enclosing `static` anonymous function, but cannot capture state outside the enclosing static anonymous function. | ||
|
|
||
| Removing the `static` modifier from an anonymous function in a valid program does not change the meaning of the program. |
There was a problem hiding this comment.
The unresolved comment #988 (comment) is regarding delegate equality for static anonymous functions. This PR doesn't state that static anonymous functions are equal (or the same instance). Roslyn doesn't guarantee that equality.
As such, the standard is fine. (An implementation could do either, as there's no requirement.) Do we want a note that clarifies this?
There was a problem hiding this comment.
Hmmm... without this, an implementation could reuse a delegate for a static anonymous function, but not reuse a delegate for a non-static one... but then removing the static modifier does change the meaning of the program. I'd be tempted to remove this line, or caveat it somewhat.
|
@jskeet This is ready for first review at our next committee meeting. |
|
|
||
| A non-`static` local function or non-`static` anonymous function can capture state from an enclosing `static` anonymous function, but cannot capture state outside the enclosing static anonymous function. | ||
|
|
||
| Removing the `static` modifier from an anonymous function in a valid program does not change the meaning of the program. |
There was a problem hiding this comment.
Hmmm... without this, an implementation could reuse a delegate for a static anonymous function, but not reuse a delegate for a non-static one... but then removing the static modifier does change the meaning of the program. I'd be tempted to remove this line, or caveat it somewhat.
f8a205b to
1948550
Compare
99625f9 to
d0035cc
Compare
d0035cc to
e5d7333
Compare
|
An earlier version of this feature is already present on |
e5d7333 to
65e32a7
Compare
65e32a7 to
846229e
Compare
Add support for static anonymous functions Add support for static anonymous functions Add support for static anonymous functions Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 21570b74-c6f5-4fc5-ab6d-7546918d6ddb
Update some language for normative reference. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 21570b74-c6f5-4fc5-ab6d-7546918d6ddb
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 21570b74-c6f5-4fc5-ab6d-7546918d6ddb
Respond to the current feedback. In addition, note that `nameof` arguments and can be used in static local functions and static anonymous functions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 21570b74-c6f5-4fc5-ab6d-7546918d6ddb
…hange Update gruntree references for part-I and part-L to wrap 'async' in the new anonymous_function_modifier node. Update RightShift stderr reference to include 'static' in the expected token list. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 21570b74-c6f5-4fc5-ab6d-7546918d6ddb
Update part-I and part-L tree reference files to wrap 'async' in anonymous_function_modifier nodes, matching the grammar change for static anonymous functions. - part-I: lambda_expression now uses (anonymous_function_modifier async) - part-L: anonymous_method_expression now uses (anonymous_function_modifier async) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 21570b74-c6f5-4fc5-ab6d-7546918d6ddb
846229e to
e66307c
Compare
|
All previous comments have been addressed, and this one is reasonably small. I think it can be merged at the next meeting. |
|
Will merge on green. |
This pulls in all the commits from #988
There is one conversation on #988 that hasn't been addressed yet: