Closed ParadaCarleton closed 3 years ago
I think we should follow the example of logpdf
and loglikelihood
and keep logdensity
. This would also be in line with the Julia style guide which generally recommends to squash words if it is readable.
I haven't been tracking this very closely, but there's a LogDensityProblems.logdensity
that's not usually user-facing from a PPL, and MeasureBase.logdensity
that's extremely user-facing (exported from Soss). How does this relate to those?
Currently it's just another function of the same name.
I think we should follow the example of
logpdf
andloglikelihood
and keeplogdensity
. This would also be in line with the Julia style guide which generally recommends to squash words if it is readable.
I agree with us wanting to keep consistency between these; all the log*
methods should be either in squash or camel case. The question is which one we should pick.
Julia style guide accepts either squash or snake, but Blue (and pretty much every other guide) requires snake.
either in squash or camel case.
The convention is to use camel case only for types and modules (both in the Julia style guide and Blue style).
Also I am pretty sure StatsBase.loglikelihood
and Distributions.logpdf
won't be renamed anytime soon, so it seems consistency can be achieved only with logdensity
.
Blue (and pretty much every other guide) requires snake.
In my experience, in practice many Julia packages that follow Blue style still use squashed function names when appropriate. Possibly due to the contradicting recommendation in the Julia style guide, possibly because it can't be enforced by JuliaFormatter, possibly because it's not a strict requirement but only a recommendation (Blue style even tells users that "most importantly: know when to be inconsistent -- sometimes the style guide just doesn't apply").
Blue style even tells users that "most importantly: know when to be inconsistent -- sometimes the style guide just doesn't apply"
No matter how much of a fan of Blue style I am or not, I think this is the key issue. All of the related functions within the relevant packages, starting from Distributions and StatsXYZ, are using this convention, and I think we shouldn't break the expectation.
Makes sense then if other places use it, I think. Mostly I've been confused by this a couple times because of the default assumption that things are in snake case, but if the functions are in squash case everywhere else, breaking that convention would cause more trouble than it's worth.
Not 100% sure if we're sticking with the Blue style guide which is the standard for most Turing things. If we are, though,
logdensity
should belog_density
. I'd suggest using that, sincesnake_case
is the standard across most style guides.