You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
REPL: Defining a variable with let with erroneous input says it is not defined. On defining it, throws an error saying it has already been defined.
#32288
Closed
13thThief opened this issue
Mar 15, 2020
· 5 comments
Define a variable test with something that will throw an error. On printing test, test is not defined, So let test = <something that doesn't throw an error>. Throws an error test has already been defined.
let test = new Date(k);
Thrown:
ReferenceError: k is not defined
test
Thrown:
ReferenceError: test is not defined
let test = 4;
Thrown:
SyntaxError: Identifier 'test' has already been declared
How often does it reproduce? Is there a required condition?
All the time. Required condition it to define the variable with let and erroneous data or something that is not defined.
What is the expected behavior?
Should be able to define test variable if it is not defined
What do you see instead?
test has already been defined and test is not defined
The text was updated successfully, but these errors were encountered:
V8 did implement a "REPL" mode for the inspector but it only supports let so far. const is still not working as expected. To make use of that mode we'll have to implement the functionality in a couple of places (at least that's how it looked like when I checked). It'll take some more time until this is fixed.
I've been tracking that too :) It works locally in my prototype repl, but mainline node needs to wait for v8 8.1 to be merged (and then needs to move to Runtime.evaluate)
can we re-open this, as a tracking issue, if there is an intent to fix this?
on the other hand if we stand on working as designed, let us tag it as wontfix?
Right now we seem to be sitting on both sides.
My take is to keep it open. Despite being spec compliant, the confusion is natural and genuine, and the number of issues on this is a proof of poor user experience on variable definition semantics
What steps will reproduce the bug?
Define a variable
test
with something that will throw an error. On printingtest
,test is not defined
, Solet test = <something that doesn't throw an error>
. Throws an errortest has already been defined
.How often does it reproduce? Is there a required condition?
All the time. Required condition it to define the variable with
let
and erroneous data or something that is not defined.What is the expected behavior?
Should be able to define
test
variable if it is not definedWhat do you see instead?
test has already been defined
andtest is not defined
The text was updated successfully, but these errors were encountered: