|
Boost : |
Subject: Re: [boost] [random] geometric_distribution backwards compatibility
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2011-01-24 01:56:12
AMDG
On 1/23/2011 10:26 PM, Patrick Horgan wrote:
> On 01/23/2011 04:40 PM, Steven Watanabe wrote:
>> Over the last year I've been (slowly) updating
>> Boost.Random to match the new standard. Unfortunately
>> I just hit a problem that I don't have a good solution
>> for. In the standard, the geometric_distribution is
>> defined as $p(i) = p(1-p)^{i}$, with i >= 0. In the
>> current Boost.Random code it is $p(i) = (1-p) p^{i-1}$,
>> with i >= 1. The definition in the standard makes
>> more sense, but I don't want to introduce a breaking
>> change. I can see two options here:
>>
>> * Leave the implementation alone and put a big
>> warning in the documentation saying that the
>> behavior doesn't match the standard.
>
> That's not good. Why would anyone want to use it after the documentation
> said that?
>
It isn't unusable. It just implements a
different variation of the distribution.
>> * Since I'm also moving things into namespace
>> boost::random, I can use the new definition
>> and leave a version with the old behavior in
>> namespace boost instead of having a using
>> declaration. I'd still have to add a warning
>> that boost::geometric_distribution isn't the
>> same as boost::random::geometric_distribution.
>
> That's better than the other, but I'd like to hear about the downside of
> a breaking change.
>
The behavior changes, but the interface doesn't.
If anyone is using this distribution and updates
Boost, their code will continue to compile and
run, but will produce the wrong results.
In Christ,
Steven Watanabe
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk