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

document REPL ast_transforms #37047

Open
stevengj opened this issue Aug 14, 2020 · 3 comments
Open

document REPL ast_transforms #37047

stevengj opened this issue Aug 14, 2020 · 3 comments
Labels
docs This change adds or pertains to documentation REPL Julia's REPL (Read Eval Print Loop)

Comments

@stevengj
Copy link
Member

stevengj commented Aug 14, 2020

Julia 1.5 includes a REPL ast_transforms variable initially added for the softscope transformation (#33864) but expanded for use by other packages (#34626, #34778), that is starting to be used by other packages. It is currently being used by Revise (timholy/Revise.jl#425), support will probably be added soon in IJulia (for the REPL.repl_ast_transforms defaults), and it might be used in the future by things like OhMyREPL.

We might consider documenting it somewhere. Maybe adding a slightly higher-level API, e.g.

REPL.current_ast_transforms() = isdefined(Base, :active_repl_backend) ? Base.active_repl_backend.ast_transforms : REPL.repl_ast_transforms
@stevengj
Copy link
Member Author

stevengj commented Aug 21, 2020

Or maybe it should be part of repl.options (the REPL.Options struct)?

@rfourquet
Copy link
Member

Maybe adding a slightly higher-level API, e.g.

REPL.current_ast_transforms() = isdefined(Base, :active_repl_backend) ? Base.active_repl_backend.ast_transforms : REPL.repl_ast_transforms

FWIW, this is almost exactly what SafeREPL uses.

@stevengj
Copy link
Member Author

stevengj commented Sep 2, 2024

Note that there is the undocumented function REPL.Numbered.__current_ast_transforms():

__current_ast_transforms() = Base.active_repl_backend !== nothing ? Base.active_repl_backend.ast_transforms : REPL.repl_ast_transforms

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

No branches or pull requests

2 participants