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

Scoped variables in anonymous functions #21

Open
VincenzoArceri opened this issue Jul 19, 2021 · 0 comments
Open

Scoped variables in anonymous functions #21

VincenzoArceri opened this issue Jul 19, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@VincenzoArceri
Copy link
Collaborator

In commit 432526b, support for the anonymous functions has been added. Nevertheless, a bug concerning the scoped variables, when the anonymous function is invoked, is still present.
Let's consider the following function

func main() {
	a := 2
	b := func(f int) int {
			return a * f
		}(5)
}

The current scoping rules hide the variable a to the anonymous function, while it should be visible to it. Currently, when the anonymous function is invoked, any variable visible before the invocation is hidden to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant