-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
Implement "eager evaluation" in the REPL #20977
Comments
I like the idea. |
The implementation might not be easy to prevent side effects though. Do you know how these are prevented in Chrome? |
@BridgeAR they use the function I linked to above in |
as a sidenote we would need to start properly marking our natively defined functions on whether they have side effects or not. |
IIUC only as progressive enhancement - things that weren't tagged would not eager-evaluate and the users would get the same UX they do today. |
V8 defines whitelists for bytecodes and builtins. During side-effect free mode, if we execute bytecode or builtins that are not whitelisted, we abort. For a greylist of bytecodes and builtins, we only allow operations on objects that have been created during side-effect free mode, to ensure that these changes do not escape. Bindings defined through the V8 API are generally not whitelisted unless explicitly marked as such. |
Note that side-effect free mode is only accessible through the DevTools protocol right now, through |
@hashseed would it be possible to expose it in a way where Node.js can use side effect free mode? I think this could be really cool to have in our REPL |
You mean as option to |
Seeing @jdalton recently joined @nodjes/repl - he didn't get the ping about this before (I think?). Regarding |
@benjamingr We currently use inspector functions in the REPL when they’re available for accessing pseudo-global-scope |
I prefer the route through inspector because it already exists and has coverage via Chrome Devtools. |
PR-URL: #21458 Refs: #20977 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: James M Snell <[email protected]>
PR-URL: #21458 Refs: #20977 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: James M Snell <[email protected]>
@rubys is this something you might be interested in? |
fwiw https://github.com/nodejs/repl has this support already. |
@devsnek Would you please post links to the relevant commits or code. |
@devsnek what's the status/plans for https://github.com/nodejs/repl ? I see that my "multiline/recoverable" changes are stalled: nodejs/repl#16 . I'm interested in helping. I'm particularly interested in #19570 |
@rubys its moving, albeit slowly 😄. i haven't really done anything with it since node started aborting on Runtime.evaluate (#22157) i'm currently rebasing some local code for vm which will enable #19570, then this weekend i'll try to get around to the repl prs but the aborting does make it difficult to properly test... @rubys if you join the @nodejs/repl team you should get write access to nodejs/repl and be able to commit and do prs and whatnot. the more the merrier :) |
Worth noting that when we deal with large objects, actually |
I believe that node in master branch should not abort any more 😄 |
@devsnek Are you still working on this? If not, should we mark it as |
Any updates on this? 🤔 |
usable repl is here: https://github.com/nodejs/repl i don't really have a plan for merging it into core right now, but someone else is always welcome to take that up. |
This adds input previews by using the inspectors eager evaluation functionality. It is implemented as additional line that is not counted towards the actual input. In case no colors are supported, it will be visible as comment. Otherwise it's grey. It will be triggered on any line change. It is heavily tested against edge cases and adheres to "dumb" terminals (previews are deactived in that case). Fixes: nodejs#20977
This adds input previews by using the inspectors eager evaluation functionality. It is implemented as additional line that is not counted towards the actual input. In case no colors are supported, it will be visible as comment. Otherwise it's grey. It will be triggered on any line change. It is heavily tested against edge cases and adheres to "dumb" terminals (previews are deactived in that case). PR-URL: #30811 Fixes: #20977 Reviewed-By: Yongsheng Zhang <[email protected]> Reviewed-By: Anto Aravinth <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
This adds input previews by using the inspectors eager evaluation functionality. It is implemented as additional line that is not counted towards the actual input. In case no colors are supported, it will be visible as comment. Otherwise it's grey. It will be triggered on any line change. It is heavily tested against edge cases and adheres to "dumb" terminals (previews are deactived in that case). PR-URL: nodejs#30811 Fixes: nodejs#20977 Reviewed-By: Yongsheng Zhang <[email protected]> Reviewed-By: Anto Aravinth <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
This adds input previews by using the inspectors eager evaluation functionality. It is implemented as additional line that is not counted towards the actual input. In case no colors are supported, it will be visible as comment. Otherwise it's grey. It will be triggered on any line change. It is heavily tested against edge cases and adheres to "dumb" terminals (previews are deactived in that case). PR-URL: #30811 Fixes: #20977 Reviewed-By: Yongsheng Zhang <[email protected]> Reviewed-By: Anto Aravinth <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
Hi, V8 has a basic way to detect side-effects and they use it for eager evaluation in the devtools.
It would be cool to allow for similar behaviour in our REPL. For clarity, here is the image of Chrome 68's behaviour:
(Image copyright (CC BY 3.0) Google Developer blog "What's New In DevTools (Chrome 68)" by Kayce Basques @kaycebasques )
@nodejs/repl
The text was updated successfully, but these errors were encountered: