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

REPL .delete meta command #37962

Closed
Annihil opened this issue Mar 29, 2021 · 5 comments
Closed

REPL .delete meta command #37962

Annihil opened this issue Mar 29, 2021 · 5 comments
Labels
feature request Issues that request new features to be added to Node.js. repl Issues and PRs related to the REPL subsystem.

Comments

@Annihil
Copy link

Annihil commented Mar 29, 2021

Is your feature request related to a problem? Please describe.
Please describe the problem you are trying to solve.

> const a = 1;
> .clear
> const a = 1;
Uncaught SyntaxError: Identifier 'a' has already been declared

Describe the solution you'd like
Please describe the desired behavior.

> const a = 1;
> .delete a
> const a = 1;

Describe alternatives you've considered
Please describe alternative solutions or features you have considered.

  • Using repl.start() and .clear but this work around is not satisfactory in my opinion.
  • Using var a = 1 but var behaves differently from let or const identifiers so not satisfactory either imo.
@Ayase-252 Ayase-252 added feature request Issues that request new features to be added to Node.js. repl Issues and PRs related to the REPL subsystem. labels Mar 29, 2021
@EladKeyshawn
Copy link

@Ayase-252 @Annihil Hey! whats the status of this feature request? is this something that should be worked on ?

@EladKeyshawn
Copy link

@Annihil Also fix typo in title 'delete'

@Annihil Annihil changed the title REPL .detele meta command REPL .delete meta command Apr 3, 2021
@Ayase-252
Copy link
Member

@EladKeyshawn

I think it would be nice to have such a feature. But I don't know whether it is feasible in Node.js. It may need some assessments from the core team.

As far as I know, console in Chrome dev tool has support to redeclare let and class, but not const.

let a = 1
undefined
let a = 1
undefined
const b = 1
undefined
const b = 1
VM215:1 Uncaught SyntaxError: Identifier 'b' has already been declared

cc @nodejs/repl

@EladKeyshawn
Copy link

@Ayase-252 I can't see why wouldn't it be feasible, I'll give a look into it. :)

@BridgeAR
Copy link
Member

BridgeAR commented Apr 6, 2021

This is pretty much a duplicate of #8309. I am going to close it as such. I guess redeclaring by default would be favorable. To support redeclaring const, there are more changes in V8 necessary. To implement redeclaring let there's work in at least the repl required and likely the vm module.

@BridgeAR BridgeAR closed this as completed Apr 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issues that request new features to be added to Node.js. repl Issues and PRs related to the REPL subsystem.
Projects
None yet
Development

No branches or pull requests

4 participants