You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
macroautoinfiltrate(cond=true)
pkgid = Base.PkgId(Base.UUID("5903a43b-9cc3-4c30-8d17-598619ec4e9b"), "Infiltrator")
if!haskey(Base.loaded_modules, pkgid)
try
Base.eval(Main, :(using Infiltrator))
catch err
@error"Cannot load Infiltrator.jl. Make sure it is included in your environment stack."endend
i =get(Base.loaded_modules, pkgid, nothing)
lnn =LineNumberNode(__source__.line, __source__.file)
if i ===nothingreturnExpr(
:macrocall,
Symbol("@warn"),
lnn,
"Could not load Infiltrator.")
endreturnExpr(
:macrocall,
Expr(:., i, QuoteNode(Symbol("@infiltrate"))),
lnn,
esc(cond)
)
end
to your startup page. If I understand right, what this does is that I can just run @autoinfiltrate whenever I would run @infilitrate, with the same effect, and just that I would not have to run using Infiltrate, and then in my code @infilitrate. Is the advantage with this that I only run using Infiltrate when I actually need it (i.e., this is an alternative to adding using Infiltrate in startup.jl, and then running infiltrate.
Does this make sense? Sorry, I was a bit uncertain of what the next mean, this is what I think will happen, but wanted to confirm what I do, before I add additional code to startup.jl.
The text was updated successfully, but these errors were encountered:
Yes, that's correct.
The benefits of that solution are somewhat dubious, given that Infiltrator loads in ~3ms and doesn't export a whole bunch of symbols, but it's an option.
I would generally recommend just using Infiltrator in your startup.jl.
thanks, that is a really useful clarification! I got a bit confused by all the code what was going on. I am just using using Infiltrator now, that seems to work well. Thansk a lot!
On the main page there is a recommendation to add
to your startup page. If I understand right, what this does is that I can just run
@autoinfiltrate
whenever I would run@infilitrate
, with the same effect, and just that I would not have to runusing Infiltrate
, and then in my code@infilitrate
. Is the advantage with this that I only runusing Infiltrate
when I actually need it (i.e., this is an alternative to addingusing Infiltrate
in startup.jl, and then runninginfiltrate
.Does this make sense? Sorry, I was a bit uncertain of what the next mean, this is what I think will happen, but wanted to confirm what I do, before I add additional code to startup.jl.
The text was updated successfully, but these errors were encountered: