
Thijs van den Berg wrote:
What do you think? We might turn "having valid parameters" into a property of *all* distribution. As an alternative, we might add a non member function bool valid<distributionType... but that wouldn't allow for caching validation in e.g. a constructor
Sounds fine to me. thats great! What's your opinion on the fact that you can only set parameter in the constructor? E.g. the normal distribution does a parameter check in the constructor, and those parameters can't change after that.
That's what the existing distributions do. In fact we could omit most of the subsequent parameter checking code if we could figure out whether the error handlers will throw or not on error (in fact we *can* get this information at compile time and make the subsequent checks a no-op if we know that the constructor would have thrown on error... we just ran out of time on that refinement).
I'll work out the parameter idea in the Laplace distribution code...
OK good.
In general (but in the scope of the constructs used in math/distributions & its non member functions): what are the arguments for placing code in either member or non-member functions ?
For implementation details, use whatever works best, for interfaces non-members that operate uniformly on a range of types seem to work best.
John. that's very pragmatic! I like that, thanks
We believe in pragmatism round here :-) John.