-
Notifications
You must be signed in to change notification settings - Fork 185
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
[DISCUSS] option for ignoring const and let #117
Comments
Here are some quick thoughts: Should we open this issue in
|
Some difficulties:
And some notes to myself: |
IMHO. It's hard to communicate with Node's core. Because "they knows better" Parser would be an overkill. Adding plugins is a great idea. But they maybe an overkill too. As an idea:
I think const/let elimination should be experimental feature. If you use it you should be aware of consequences. "Provided as is" |
What would be the difference between |
MIME... It would be to complicated. Let's forget this |
This definitely doesn't behave as expected. I would expect it to run similar to calling Is there some way to run the script like new, clearing previous memory, when I make changes to variables? |
You have to use "Hydrogen: Restart Kernel" to restart your session. There is another builtin command in Hydrogen called "Hydrogen: Restart Kernel and Re Evaluate Bubbles" which will restart and then run each of the lines or blocks you've done previously as individuals chunks of code. At least for me, I have these two in my keymap: 'atom-text-editor':
'cmd-enter': 'hydrogen:run'
'cmd-b': 'hydrogen:restart-kernel-and-re-evaluate-bubbles' |
I would solve this issue like this:
ContextifyScript.Script.runInThisContext(); with ContextifyScript.Script.runInContext(currentContext);
If the code errors out, parse the error to check for this pattern:
if this pattern matches, create a new context to be used across the current session, and run the code again, any error created afterwards is propagated to the user.
I have not looked into the ijavascript code yet, but I am hoping to get some feedback on this before I do so. |
@Bamieh At the very beginning of IJavascript, I experimented with [] instanceof Array // true
vm.runInContext("[] instanceof Array", vm.createContext({Array})); // false Another difficulty with this idea of recreating the context is that the state of previous context would be lost. The way I see this issue is that IJavascript is an enriched REPL for When I use IJavascript as a REPL, I prefer to use When I use IJavascript to run a a script, then the normal rules for Picking up @rgbkrk 's suggestion and your idea, I could implement |
@n-riesco why would you pass Array to the new context 🤔 , it gives false because the Array you passed is pointing to a different location in memory than the one created by To solve the previous context issue, we just track added objects on the global (observers or manually) and propagate them in the new context. Implementing a restart is not a good idea imo, since it might break other code blocks depending on previous code. If the code is to be run in an isolated scope, anyone can write this:
#blocks_are_the_new_iffe 😆 |
@Bamieh I'm moving the discussion to n-riesco/nel#9 |
Hello, Nicolas.
May I suggest to add argument to kernel which cut const and let keywords before processing code.
In hydrogen it's really annoying to get:
Identifier is already declared
while you experimenting with code.I can make PR
The text was updated successfully, but these errors were encountered: