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

compiler error for variable use before declaration #1555

Closed
michaelficarra opened this issue Jul 30, 2011 · 1 comment
Closed

compiler error for variable use before declaration #1555

michaelficarra opened this issue Jul 30, 2011 · 1 comment

Comments

@michaelficarra
Copy link
Collaborator

From @jashkenas's message on #1121:

Great -- let's add a compiler error for variables being used before they're declared ... in cases where a subsequent declaration would be sure to shadow.

@jashkenas
Copy link
Owner

I'm afraid this doesn't seem too feasible -- both because we'd have to introduce the notion of keeping track of every variable used in the program, along with their visibility to other scopes ... and because it makes some existing valid programs into errors:

# Here, api is a global variable from another file.
api.object = {}

# Deep inside some inner function later on the page:
-> 
  api = {}

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

3 participants