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

use REPL ast_transforms in Julia 1.5+ #423

Closed
stevengj opened this issue Feb 13, 2020 · 2 comments · Fixed by #425
Closed

use REPL ast_transforms in Julia 1.5+ #423

stevengj opened this issue Feb 13, 2020 · 2 comments · Fixed by #425

Comments

@stevengj
Copy link

In Julia 1.5 or later (JuliaLang/julia#34626), you can just do

pushfirst!(Base.active_repl_backend.ast_transforms, my_transformation)

to tell the REPL to perform arbitrary AST transformations. (pushfirst! will do ast = my_transformation(ast) on each parsed ast before the default REPL.softscope transformation in Julia 1.5.)

This should be simpler than your current steal_repl_backend machinery, and more importantly it is composable with other code that wants to hook into the REPL.

@timholy
Copy link
Owner

timholy commented Feb 15, 2020

Thanks for doing this, we've needed something like this for a long time.

@stevengj
Copy link
Author

(Are there other REPL-stealing packages that should be using this mechanism too?)

timholy added a commit that referenced this issue Feb 24, 2020
timholy added a commit that referenced this issue Mar 26, 2020
timholy added a commit that referenced this issue Mar 26, 2020
timholy added a commit that referenced this issue Mar 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants