[Version 9.0] Feature support for Static anonymous functions #1461
[Version 9.0] Feature support for Static anonymous functions #1461BillWagner wants to merge 6 commits into
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
Add support for static anonymous functions Add support for static anonymous functions Add support for static anonymous functions
Update some language for normative reference.
Respond to the current feedback. In addition, note that `nameof` arguments and can be used in static local functions and static anonymous functions.
…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>
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>
d0035cc to
e5d7333
Compare
|
An earlier version of this feature is already present on |
This pulls in all the commits from #988
There is one conversation on #988 that hasn't been addressed yet: