Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Champion "Local Functions" (C# 7.0) #56

Open
4 of 5 tasks
gafter opened this issue Feb 10, 2017 · 8 comments
Open
4 of 5 tasks

Champion "Local Functions" (C# 7.0) #56

gafter opened this issue Feb 10, 2017 · 8 comments
Assignees
Labels
Implemented Needs ECMA Spec This feature has been implemented in C#, but still needs to be merged into the ECMA specification Proposal champion
Milestone

Comments

@gafter
Copy link
Member

gafter commented Feb 10, 2017

See also

@gafter gafter self-assigned this Feb 10, 2017
@gafter gafter modified the milestone: csharp7.0 Feb 10, 2017
@gafter
Copy link
Member Author

gafter commented Feb 10, 2017

This is a "proposal issue" because we need to add a proposal/spec to the repo.

@gulshan
Copy link

gulshan commented Mar 13, 2017

Should inferring return type for local functions in a later version of C# as mentioned here- dotnet/roslyn#2930 (comment) be discussed in a separate issue?

@bbarry
Copy link
Contributor

bbarry commented Mar 13, 2017

separate; this is for the feature as it shipped in C#7

@jcouv jcouv changed the title Champion "Local Functions" Champion "Local Functions" (C# 7.0) Sep 2, 2017
@lillo42
Copy link

lillo42 commented Apr 18, 2019

I don't if here is the correct place for my question.

What is the naming convention for local function? PascalCase or camelCase

The roslyn project I saw camel case, but at Local Function Document use pascal case

@YairHalberstadt
Copy link
Contributor

@Lilo42
I don't think Microsoft defines one. I'm guessing that since the members are not part of the public API they see no need to mandate consistency.

@CyrusNajmabadi
Copy link
Member

The roslyn project I saw camel case

Roslyn-IDE uses PascalCase since these are viewed the same as methods, just placed inside the body of something.
Roslyn-Compiler uses camelCase since these are viewed as locals.

As you can see, even on hte Roslyn team there are differing opinions on which way is most appropriate. I personally prefer PascalCase as it lets me easily see if i'm invoking some local/parameter/delegate, versus invoking something that is actually a Function/Method.

As these are locals, there's not really going to be any strict guidance on how you name things as it's basically up to you.

@lillo42
Copy link

lillo42 commented Apr 22, 2019

@CyrusNajmabadi and @YingdaBeyondsoft Thank you. I prefer PascalCase too.

@333fred 333fred added the Implemented Needs ECMA Spec This feature has been implemented in C#, but still needs to be merged into the ECMA specification label Oct 16, 2020
@gafter
Copy link
Member Author

gafter commented May 13, 2022

Specification in progress at dotnet/csharpstandard#104.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Implemented Needs ECMA Spec This feature has been implemented in C#, but still needs to be merged into the ECMA specification Proposal champion
Projects
None yet
Development

No branches or pull requests

7 participants