-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
Do not assign const variable in error case #20056
Comments
@TimothyGu for me it is not about spec compliance but about a better way to handle it in the repl. So this issue should be about evaluating to diverge from the spec. I am not sure about the current implementation details and if that is even possible. |
cc @bmeck your repl proposal makes const not constant right? |
Mime keeps const unable to be reassigned, but separate inputs can rebind the variable name to a new binding. |
@bmeck for me having const not possible to be reassigned is the worst thing in the repl ;-) |
When using the repl and e.g., writing:
const foo = bar()
whilebar
is undefined is going to cause an error. So far so good. The problem is thatfoo
is now assigned even though it would be super nice if that would not be the case due to the error while assigning the variable.I tried to see how to fix this on my own but it is somewhere in runInContext if I am not mistaken and I have never looked at that part before.
@nodejs/vm @nodejs/repl
The text was updated successfully, but these errors were encountered: