
Thijs van den Berg wrote:
ah! you're saying you van have one type of policy for the distribution (construtor) and another policy type in some non-member function like pdf. that explains the things I'm seeing!
Nope, the policy that the distribution has applies to all the non-member functions as well, it's just that the *error handlers may not throw, but return an error value instead*.
A final question regarding the error checking is this: Suppose a distribution has a couple of valid an invalid parameters. E.g. normal(2,0), whith has a valid mean=2 and invalid std=0. Formally that would make the distribution object invalid... There are at least two possible view on what to do with non-member fuctions. 1) Make *all* of them return NaN because the distribution in invalid. This is a mathematical interpretation or 2) (current implementation) try to give an answer when possible, this is a "can we calculate the result?" interpretation. In this case we can calculate the mean (it's 2), but we can't calculate the pdf because that would give an divide by zero.
I'm asking this because I'd like to stick to you're approach with new code, and *not* because I want to discuss a preference for any of the two... :)
Ah, OK, in that case, let's continue with the status quo :-) John.