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

Current scoping mechanism is broken #34

Open
GoogleCodeExporter opened this issue Apr 11, 2015 · 2 comments
Open

Current scoping mechanism is broken #34

GoogleCodeExporter opened this issue Apr 11, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

I've talked with Manuel and we both agree that the scoping mechanism that is 
currently 
implemented is broken.  There are a number of bugs already submitted that have 
to do with the way 
that we currently create and search through scopes.  We've decided to try to 
replace it with what 
essentially will be a stack of maps from variable names to the objects they are 
bound to.

Original issue reported on code.google.com by [email protected] on 2 Jun 2010 at 2:36

@GoogleCodeExporter
Copy link
Author

To elaborate more on the semantics of this change, each scoping level will be 
represented by a single map in the 
stack of maps.  Whenever we enter a new scope, we push a new map onto the 
stack.  Whenever we need to 
perform a lookup for a variable name, we search from the top of the stack 
downwards, using the first entry that 
we find.  If we do not find anything, then we throw an error.

This also alleviates some of our issues with lambdas.  Whenever we instantiate 
a lambda, we make a copy of the 
current map and store it with the lambda.  That way, the state of the bound 
variables in the lambda is essentially 
frozen.

Original comment by [email protected] on 2 Jun 2010 at 2:43

@GoogleCodeExporter
Copy link
Author

Original comment by [email protected] on 2 Jun 2010 at 3:44

  • Changed state: Started

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant