I think along with TuringLang/Bijectors.jl#418 this is all that's needed to get Turing to sample ProductNamedTupleDistribution. Oh, also some output_size(f, sz) need to be changed to output_size(f, dist) instead.
Note that unpacking syntax on the LHS of tilde will still not be allowed. Thus
@model function f()
x ~ product_distribution((a = Normal(), b = LogNormal()))
y ~ Normal(x.a, x.b)
end
is OK, but this is not
@model function f()
(; a, b) ~ product_distribution((a = Normal(), b = LogNormal()))
y ~ Normal(a, b)
end
Making the latter work will require changes to the compiler. In any case people can always do
@model function f()
x ~ product_distribution((a = Normal(), b = LogNormal()))
(; a, b) = x
y ~ Normal(a, b)
end
so I don't see this as much of a loss.