[Version 9.0] Feature support for Static anonymous functions #1461
[Version 9.0] Feature support for Static anonymous functions #1461BillWagner wants to merge 4 commits intodraft-v9from
Conversation
Add support for static anonymous functions Add support for static anonymous functions Add support for static anonymous functions
7133dbb to
69a8d66
Compare
Update some language for normative reference.
standard/expressions.md
Outdated
|
|
||
| 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. |
standard/expressions.md
Outdated
|
|
||
| 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.
Respond to the current feedback. In addition, note that `nameof` arguments and can be used in static local functions and static anonymous functions.
This pulls in all the commits from #988
There is one conversation on #988 that hasn't been addressed yet: