Use a ref struct for local function captures. #1809
Unanswered
ThadHouse
asked this question in
Language Ideas
Replies: 1 comment
-
Local functions can be converted to delegates, so they can escape. If the compiler can prove they never get captured or converted to a delegate, then it's known that they can't escape. I'm not sure this question is specific to Span, though. The same rules apply for all |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Since the local function captures can't escape, it seems like they should just be able to be ref structs. By doing this, capturing spans into local functions would be allowed, which would be nice. I can't see any reason this would break any existing code, since you can't get direct access to the capture variable anyway.
I tried looking for an existing issue about this, and couldn't find one.
Beta Was this translation helpful? Give feedback.
All reactions