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

Support for "var" declared return type in local functions #5168

Closed
gafter opened this issue Sep 11, 2015 · 9 comments
Closed

Support for "var" declared return type in local functions #5168

gafter opened this issue Sep 11, 2015 · 9 comments
Labels
Area-Language Design Feature Request Resolution-Won't Fix A real bug, but Triage feels that the issue is not impactful enough to spend time on.

Comments

@gafter
Copy link
Member

gafter commented Sep 11, 2015

The current prototype for local functions has an incomplete implementation of support for an inferred return type.

It should either be fully specified and implemented, or the support should be removed and left for a possible future revision.

@gafter gafter self-assigned this Sep 11, 2015
@gafter gafter added this to the C# 7 and VB 15 milestone Sep 11, 2015
@gafter gafter modified the milestones: 2.0, C# 7 and VB 15 Sep 11, 2015
@gafter gafter added help wanted The issue is "up for grabs" - add a comment if you are interested in working on it and removed Area-Language Design labels Sep 11, 2015
@gafter
Copy link
Member Author

gafter commented Sep 11, 2015

This and #5173 have some unfortunate interactions. It is much simpler to do one or the other.

@ldematte
Copy link

ldematte commented Nov 3, 2015

I see this is marked "Up for Grabs". I'd like to give it a go; as this is my first contribution, I was looking at something non-trivial but rather contained. Any advice/thoughts?

@gafter
Copy link
Member Author

gafter commented Nov 3, 2015

@ldematte I suggest you see how a return type is inferred for a lambda expression. The same techniques should be usable with local functions. It means that the local function body will have to be bound more than once - once to infer the return type, and once to bind the body with the return type known.

However, I believe we are more likely to want to do #5173, and the two features conflict with one another. I don't believe it is reasonable to have both in the language.

@ldematte
Copy link

ldematte commented Nov 9, 2015

Thank you for your comment, @gafter.
So, if I understood it correctly, you are suggesting that I look into something else (#5173, perhaps?), because this one will likely not make into the language?

@gafter
Copy link
Member Author

gafter commented Nov 9, 2015

@ldematte Yes, that's right. We want #5173, but we don't have anyone assigned to do that work right now.

@ldematte
Copy link

If you don't mind, I would like to give it a shot. It'd be my first contribution to Roslyn, but I have worked on compilers before, so I should be able to tackle it (in due time - if you need it quickly, I can pass)

@gafter
Copy link
Member Author

gafter commented Nov 10, 2015

@ldematte I'm not sure #5173 is a good candidate - we haven't yet worked out the specification for how exactly that should work (for example, if I call local function A and then local function B, and the former assigns to a local variable that is read by the latter, is that supposed to be allowed by the rules for definite assignment?) We have some language design work still to go, and then there is going to be a fair amount of algorithm design needed for that one. Also it has a clock that is ticking, since the local function feature has already been checked in to our future branch... Do any of (#357 #262 #158) look interesting to you? The first is a big one but self-contained, and the other two are smallish.

@ldematte
Copy link

I finally had some time to review them (you guys write a lot, awesome!) and I like #357 very much! It is quite well defined, specified and contained. I suppose it will be implemented with the hide(new)/override + bridge, plus attribute copy, plus the "at most a single intermediate method at runtime" optimization (not with the custom attribute).
How should I start? From the spec and tests, maybe? (sorry, very first time contributing here...)

@gafter
Copy link
Member Author

gafter commented Nov 13, 2015

@ldematte lets move the discussion to #357

@jaredpar jaredpar removed this from the C# 7 and VB 15 milestone Nov 23, 2015
@gafter gafter added Area-Language Design Resolution-Won't Fix A real bug, but Triage feels that the issue is not impactful enough to spend time on. and removed Area-Compilers help wanted The issue is "up for grabs" - add a comment if you are interested in working on it Feature Specification labels Dec 2, 2015
@gafter gafter closed this as completed Dec 2, 2015
@bbarry bbarry mentioned this issue Jan 30, 2017
30 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Language Design Feature Request Resolution-Won't Fix A real bug, but Triage feels that the issue is not impactful enough to spend time on.
Projects
None yet
Development

No branches or pull requests

3 participants