[Proposal] readonly local functions #9443
Replies: 1 comment 3 replies
-
Did you mean to say
Ordinary local functions have full access to the instance and instance members.
At the moment |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
Local functions currently support the
async
,unsafe
,static
andextern
modifiers. This is a proposal to include thereadonly
modifier.Motivation
Local functions as they are implemented, even when they are used in moderation, can obscure updates to captured variables and thereby make it harder to read and debug code which uses them. Often, developers want to write local functions which do not update captured variables but there it currently no way to restrict local functions in this way whilst at the same time benefiting from the convenience of captured variables.
Proposed behaviour
in
arguments).Concerns
Beta Was this translation helpful? Give feedback.
All reactions