Best practices (for package code), e.g. no "using"

E.g. using is “considered harmful” for package code. There’s disagreement on recommending against it in the Julia docs, but it can for sure go into some style-guide, and maybe is already there. eval should neither be used there, more examples?

Julia currently supports all the same code in packages as elsewhere, but for Julia 2.0 (or had it be planned from the start), it could have only allowed a subset. At least a subset can be easier on the compiler, i.e. not needing it at runtime, what e.g. eval forces. Ideally package code could be compiled with StaticCompiler.jl but we are far away from that, so it can’t be that limiting, at least yet.

Some things are not about that, rather API issues, e.g. using is ok for the REPL, we might want or need such extra keywords there, and only there.

This newly opened issue just got me thinking what we really need, or might want to do without, rather than add more options, go with fewer(?):

Also this very old issue (we’ve done fine without so far):

I don’t agree

I find it enormously difficult to read Julia code in a foreign package without cloning locally so I can be constantly grepping

I wouldn’t call that “fine”

2 Likes