Distributions.jl interop for probprog

The first official release of Distributions.jl was in 2013, 6 years ago, before the actual release of Julia 0.3. IMO a lot of its design reflects that, eg

  1. it is full of ostensibly performance-enhancing checks and conversions which may not needed anymore, as the compiler got way smarter,

  2. the idiomatic Julia style for writing generic code has matured a lot since these days, using traits instead of elaborate type hierarchies, and duck typing where one can get away with it.

This is natural — code ages, and needs to be dusted off occasionally.

A complete, breaking rewrite & refactor by a small team of experienced Julia programmers would probably be the best way to remedy this, but I am not sure how to engineer the consensus necessary for that. It may come to a complete rewrite in a parallel package.

A lot of the checks could probably be removed and the code would just error anyway for incompatible dimensions. All subtypes of Real, and vectors with elements ::Real (not necessarily Vector{<:Real}, for well-known reasons, eg Any[1.0, 1]) should just work.

But for other types, eg symbolic, you may have to provide your own methods if they cannot trickle through an interface designed for numbers. Eg I am not sure what ApproxFun.Fun should do as an argument.

3 Likes