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

Pre and post execute hooks for REPL #6445

Closed
malmaud opened this issue Apr 7, 2014 · 6 comments
Closed

Pre and post execute hooks for REPL #6445

malmaud opened this issue Apr 7, 2014 · 6 comments
Labels
REPL Julia's REPL (Read Eval Print Loop)

Comments

@malmaud
Copy link
Contributor

malmaud commented Apr 7, 2014

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?

@mbauman
Copy link
Member

mbauman commented Apr 7, 2014

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.

@chrisvwx
Copy link
Contributor

chrisvwx commented Dec 3, 2016

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.

@cstjean
Copy link
Contributor

cstjean commented Dec 3, 2016

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, Base.REPL is completely undocumented AFAICT, and the R mode is a 1000 lines of code. Can anyone guess how much work that would be? Obviously, we wouldn't want to lose other REPL features.

@StefanKarpinski
Copy link
Member

REPL code seriously needs a refactor + documentation pass. Having a real API would be great.

@stevengj
Copy link
Member

stevengj commented Feb 13, 2020

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.

@KristofferC
Copy link
Member

Seems powerful enough to warrant this to be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
REPL Julia's REPL (Read Eval Print Loop)
Projects
None yet
Development

No branches or pull requests

9 participants