# Immutable deprecation fix in BayesianDataFusion

I’m a Julia noob and I’m trying to get BayesianDataFusion.jl to work with 0.6. I found that the issue I have is related to the deprecation of `immutable` to using `struct`. I created an attempt at a fix but I have zero confidence in it. I also opened an issue on the package’s github page but I don’t think the maintainer will get to it soon issue 9. You can see below the original code and my fix. Does anyone have suggestions on a better attempt?

### Deprecated 0.5 code

``````using Compat
using Distributions
using PDMats

import Base.LinAlg: Cholesky

immutable NormalWishart <: Distribution
dim::Int
zeromean::Bool
mu::Vector{Float64}
kappa::Float64
#Tchol::Cholesky{Float64}  # Precision matrix (well, sqrt of one)
T::Matrix{Float64}
nu::Float64

function NormalWishart(mu::Vector{Float64}, kappa::Real,
T::Matrix{Float64}, nu::Real)
# Probably should put some error checking in here
d = length(mu)
zmean::Bool = true
for i = 1:d
if mu[i] != 0.
zmean = false
break
end
end
@compat new(d, zmean, mu, Float64(kappa), full(Symmetric(T)), Float64(nu))
end
end

function NormalWishart(mu::Vector{Float64}, kappa::Real,
T::AbstractMatrix{Float64}, nu::Real)
NormalWishart(mu, kappa, full(T), nu)
end

import Distributions.rand

function rand(nw::NormalWishart)
Lam = rand(Wishart(nw.nu, nw.T))
mu = rand(MvNormal(nw.mu, full(inv(Symmetric(Lam))) ./ nw.kappa))
return (mu, Lam)
end
``````

### Attempted fix for 0.6

``````struct NormalWishart{I<:Int, B<:Bool, Num<:Real, ST<:AbstractPDMat}  <: ContinuousMatrixDistribution
dim::I
zeromean::B
mu::Vector{Num}
kappa::Num
#Tchol::Cholesky{Num}  # Precision matrix (well, sqrt of one)
T::ST
nu::Num
end
``````

Why do you think this is the case?

However, if you have a strong reason to believe this, your best bet is to

1. fork the package on github,
2. clone and branch (in `git`),
3. make the change, and see if CI on Travis works. You will need to enable CI for 0.6 in `.travis.yml`.

Then you can submit this as a PR, or if the maintainer is unresponsive, you may consider adopting the package if you find it useful.

See the manual for more guidance.

Thanks, I’ll test with Travis. I’m not sure the maintainer will get to it because the Python implementation has been actively worked on in the past 2 months but the Julia source has been over a year since it’s been worked on.