Skip to content

Error with let: "Identifier '*' has already been declared" on REPL #8441

@zladuric

Description

@zladuric

The problem I'm seeing is that if during declaring a variable with let something throws - that identifier is "taken", but I can't use it.

Essentially like this (stripped unnecessary stack).

let broken = JSON.parse('I am broken');
> SyntaxError: Unexpected token I
let broken = 5;
> TypeError: Identifier 'broken' has already been declared
let broken = 5;
> TypeError: Identifier 'broken' has already been declared

I'm seeing this for a long time, but never took an effort to look into it more.

Now I'm curious - is this expected behaviour? Why? If not, how can one go about and fix it?

It's on Node 5 and latest 6, but I believe I've seen it on older versions as well.

[zlatko@zlatko-desktop ~/tmp]$ node -v
v5.12.0
[zlatko@zlatko-desktop ~/tmp]$ uname -a
Linux zlatko-desktop 4.4.0-36-generic #55-Ubuntu SMP Thu Aug 11 18:01:55 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    replIssues and PRs related to the REPL subsystem.v8 engineIssues and PRs related to the V8 dependency.wontfixIssues that will not be fixed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions