Closed danielturek closed 9 months ago
I think I would argue that instead we should not allow default arguments for user-defined distributions (by analogy with standard distributions).
@danielturek what do you think about me adding a check that errors out if there is a default?
@paciorek Yes, that makes more sense, stepping back and looking at this again. I'm on board with your suggestion.
Ok, I've added an error trap in checkDistributionFunctions
in branch fix_1345
.
Fixed by PR #1371
When defining the density function of a custom distribution, the type-checking that takes place in
registerDistributions
does not allow a default value forx
. During the type-checking, we require anidentical
to pass for the return type defined by the density function (in the dist <- nimbleFunction(x = ...
) of the argument list), and thereturnType
statement of the generation function. If you provide a default value ofx
in the density function, thisidentical
check fails. Example below: