Closed jmatsushita closed 7 years ago
First of all, I have to say this is the expected behaviour: const
was introduced in JS to ensure a variable doesn't get reassigned (Note that, similarly, let
doesn't allow the re-declaration of a variable). The use of const
or let
inside the global scope will prevent you from re-running a cell (unless the kernel session is restarted).
Since IJavascript is a JS kernel and const
is part of JS, I think a kernel like jp-babel would be a more suitable kernel for the needs I can infer from your post.
I imagine one could write a plugin that replaces all const
's and let
's in the global scope by var
's, so that no exceptions is thrown when a cell is re-run without restarting the kernel session.
Out of curiosity: you say that "Not use const" "didn't work for you". Why was that?
I'm closing the issue, but, please, feel free to continue the discussion here.
const
makes sense. But I would use redefine a class interactively making changes. How can we achieve that?
In Scala kernel, rerunning a cell say with val a = 10
doesn't throw any error, but instead overrides it. But of course if we try a = 20
later it complains as expected. Can this behavior be achieved?
@Nithanaroy What I wrote above still applies. I don't see how to achieve this without parsing each execution request:
await
at REPL level.
What's the elegant way to avoid having these popping up? The ways I know work are:
The way I tried which didn't work for me are:
:)