Distributions.jl icon indicating copy to clipboard operation
Distributions.jl copied to clipboard

Re-export from LinearAlgebra and FillArrays

Open torfjelde opened this issue 4 years ago • 7 comments

Deprecations introduced in #1362 suggest alternatives that use the following:

  • LinearAlgebra.Diagonal
  • LinearAlgebra.I
  • FillArrays.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.

torfjelde avatar Jul 17 '21 20:07 torfjelde

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?

devmotion avatar Aug 26 '21 16:08 devmotion

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:)

torfjelde avatar Aug 26 '21 18:08 torfjelde

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.

mschauer avatar Aug 27 '21 13:08 mschauer

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).

ParadaCarleton avatar Sep 22 '21 16:09 ParadaCarleton

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.

devmotion avatar Sep 22 '21 19:09 devmotion

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.

Sounds good :+1:

torfjelde avatar Oct 04 '21 10:10 torfjelde

I like that idea.

ghost avatar Oct 04 '21 15:10 ghost