-
Notifications
You must be signed in to change notification settings - Fork 432
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rename Uniform
?
#359
Comments
Comment on Reddit:
Personally I still slightly prefer the name If you look at the name What I can imagine as a nice direction is to implement But to focus on the important part first: should we do a last-minute (last-week or something) rename of |
Why is that a problem? It is always an option to use it qualifiedly like |
It's true Instead, I'd suggest more meaningful names like If trait objects of distributions get used, then maybe one could eventually do clever ZST trait object stunts like:
|
Uh-oh I have started a bikeshed and everyone has a different opinion 😄. Personally I think When would it be used?If people continue to use Then there is implementing the distribution for user types: use rand::distributions::{Distribution, Uniform}
impl Distribution<MyType> for Uniform {
/* ... */
} And it can be used in trait bounds instead of the current impl<T> Distribution<Option<T>> for Uniform where Uniform: Distribution<T> {
/* ... */
} Let's try it out
use rand::distributions::{Distribution, Uniform};
rng.sample(Uniform);
impl<T> Distribution<MyType<T>> for Uniform
where Uniform: Distribution<T> { /* ... */ }
use rand::distributions;
use rand::distributions::Distribution;
rng.sample(distributions::Default);
impl<T> Distribution<MyType<T>> for distributions::Default
where distributions::Default: Distribution<T> { /* ... */ }
use rand::distributions::{Distribution, Basic};
rng.sample(Basic);
impl<T> Distribution<MyType<T>> for Basic
where Basic: Distribution<T> { /* ... */ }
use rand::distributions::{Distribution, Derived};
rng.sample(Derived);
impl<T> Distribution<MyType<T>> for Derived
where Derived: Distribution<T> { /* ... */ }
use rand::distributions::{Distribution, Structured};
rng.sample(Structured);
impl<T> Distribution<MyType<T>> for Structured
where Structured: Distribution<T> { /* ... */ } ... use rand::distributions::{Distribution, Random};
rng.sample(Random);
impl<T> Distribution<MyType<T>> for Random
where Random: Distribution<T> { /* ... */ } |
In my experience there is only one real problem: when forgetting to |
If we can't use The defining characteristic of this distribution is that it is what you get without any parameterisation. That makes a name like |
👍 to |
I agree I'm missing why "distribution is .. what you get without any parameterisation". It's true a uniform distribution has no parameters, and this distribution has no run time parameters, but.. Actually
|
All of the distributions should be typed though, unless they are only implemented for a single type (like the current statistical ones only having A true uniform distribution does have parameters: the minimum and maximum values (and closed/open nature on reals), which is why we have a suggestion to rename
There is such a thing as a Standard Exponential Distribution. Calling the Standard Normal just |
I think |
#369 renames to |
Previous discussion around the names is in dhardy#81, and a little on the first RFC discussion thread.
Uniform
is the distribution that is going to replace theRand
trait. All code that now implementsRand
should eventually switch over. We should make sure we are happy with the name, I don't think we make people happy breaking the same code another time...The text was updated successfully, but these errors were encountered: