Distributions.jl
Distributions.jl copied to clipboard
Re-export from LinearAlgebra and FillArrays
Deprecations introduced in #1362 suggest alternatives that use the following:
LinearAlgebra.DiagonalLinearAlgebra.IFillArrays.Fill
It seems like these should then also be re-exported, in particular since Distributions.jl is a package that is often used by Julia beginners who might not be aware of where the above can be found.
I am a bit unsure about this PR. I agree that it might be more convenient since one can skip an using LinearAlgebra or using FillArrays but it seems it can become difficult to draw a line here. Should we reexport Zeros as well which is used in MvNormal? Or PDMat, ScalMat and PDiagMat which can be used in the constructor? So maybe it is more a documentation issue and should not be solved with reexporting I, Fill and Diagonal?
Yeah that's a fair point :+1:
One argument for exporting is that Distributions.jl has become a package that a lot users will interact with for the first time, and so making it completely trivial to use without any "surprises", e.g. examples not being completely "self-contained" in the sense that external dependencies are explicitly required, might be worth it.
But I leave this up to you all:)
I think we should not do it, it feels like working against the grain of Julia, after all
~$ exec '/Applications/Julia-1.6.app/Contents/Resources/julia/bin/julia'
julia> I
ERROR: UndefVarError: I not defined
seems to be a hurdle which has to be overcome in any case if someone wants to use Julia. But let's make sure the docs are helpful.
I will add a slight comment (which you can feel free to ignore) -- I personally had exactly this problem when working with Distributions.jl a couple months ago as a beginner in Julia (I didn't realize I is only part of LinearAlgebra).
I think we should qualify all functions, structs etc. from other packages in the docs, e.g., we should write LinearAlgebra.I or LinearAlgebra.Diagonal instead of I or Diagonal to make it clear where these objects are defined. IMO, though, we should not reexport Fill, Diagonal, I, PDMat etc.
I think we should qualify all functions, structs etc. from other packages in the docs, e.g., we should write
LinearAlgebra.IorLinearAlgebra.Diagonalinstead ofIorDiagonalto make it clear where these objects are defined. IMO, though, we should not reexportFill,Diagonal,I,PDMatetc.
Sounds good :+1:
I like that idea.