-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Pre and post execute hooks for REPL #6445
Comments
I've been mulling over an API for the REPL myself — for allowing users to interactively change their keybindings. One of the surprising difficult things here is simply grabbing a reference to the REPL. It's designed in an amazingly asynchronous and re-entrant manner such that there can be multiple invocations within the same process — both nested and (I think) alongside eachother. It's really cool. But it makes this kind of API very tricky. |
I'd love to have hooks to call ClobberingReload.jl before each command as described above by malmaud. This is one thing that Matlab is ahead of Julia in; I don't ever need to 'reload' or 'creload' files; it's done automatically for me through the magic of ... computers. |
We could work around the lack of built-in hooks via a custom REPL mode, that behaves like normal Julia, except with preexecution hooks. Unfortunately, |
REPL code seriously needs a refactor + documentation pass. Having a real API would be great. |
Is this closed by #34626? You can now push a custom AST transformation to any REPL backend instance. This could add pre-execution or post-execution code as well as transforming the user's code in any other way. |
Seems powerful enough to warrant this to be closed. |
A cool feature for the REPL would be an API to specify functions that run before or after each invocation of a command. 3rd party plugins could then do things like reload a module before each command is executed, or implement some kind of custom logging after execution. IJulia and IPython support this.
Thoughts?
The text was updated successfully, but these errors were encountered: