dotnet / csharplang

The official repo for the design of the C# programming language
11.4k stars 1.02k forks source link

Champion "static local functions" (16.3, Core 3) #1565

Open jcouv opened 6 years ago

jcouv commented 6 years ago

The proposal is to declare a local function as non-capturing. The keyword to indicate that would be static.

Note: if we do this, then we should also consider allowing parameters and locals of the local function to shadow parameters and locals from the containing method.

Related discussion thread, including a discussion of "capture lists" (a more elaborate feature): https://github.com/dotnet/csharplang/issues/1277

Note: EE scenarios are a concern.

Do we want to allow some other modifiers (like unsafe)?

LDM history: