-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DensityKind(::Type)
#12
Comments
Can you use check_tilde_rhs(x::AbstractArray) = isempty(x) || check_tilde_rhs(x, DensityKind(first(x)) or so?
Yes, we discussesd this, the conclusion was that the argument should be the value instead of the type (it had been the type in the first design iteration of DensityInterface).
I used a type-argument design for |
I suggested something similar in TuringLang/DynamicPPL.jl#342 (comment) 🙂 ( |
Okay then... |
I wonder why I have missed this before, but maybe it has been discussed somewhere... I currently want to implement dispatch like
which with the current interface doesn't work.
I'd have expected that
DensityKind
is defined on the type, and then defaultsDensityKind(object) = DensityKind(typeof(object))
, just likeeltype
. Yeah, this kind of defaulting is discouraged, but IMHO sufficiently close toeltype
to make sense. I'd even be happy with only the type-based method, but extending the interface is backwards compatible. The only real change would be to require implementors define the type method, not the object method.Is there any case where
DensityKind(typeof(object))
doesn't make sense?The text was updated successfully, but these errors were encountered: