-
-
Notifications
You must be signed in to change notification settings - Fork 473
Description
Summary
Rename the module rand::distributions
to rand::distr
.
Add an alias re-exporting the module through rand::distributions
to avoid unnecessary breakage.
pub mod distr;
#[doc(no_inline)] pub use distr as distributions;
Motivation
distr
is easier to type thandistributions
- Consistency with
rand_distr
- Consistency with the Rust standard library which abbreviates most long module names (
cmp
,env
,alloc
,mem
, but exceptionallycollections
)
Note: we do not abbreviate to dist
partly because rand_distr
already established a convention but mostly "distr" is relatively unambiguous whereas "dist" has other likely meanings.
Making distr
the official module name encourages usage; adding distributions
as an alias limits breakage for the many existing users.
Alternative: no alias
The plan above is to never remove the alias: there is no support for deprecating aliases. This may cause users some confusion when reading code, especially if we choose to hide the alias in docs.
As an alternative, we could rename without an alias. Most users should only need to fix a few imports or can easily search-and-replace rand::distributions
, besides which the next release will have some breakage (notably, distribution constructors now return a Result
).