[Issue 9106] Rename std.random.randomShuffle as std.random.shuffle and small usage change

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Mar 22 05:28:47 PDT 2014


https://d.puremagic.com/issues/show_bug.cgi?id=9106



--- Comment #6 from bearophile_hugs at eml.cc 2014-03-22 05:28:41 PDT ---
(In reply to comment #5)
> Is there any favour for renaming the other randomSomething functions and types
> in this way? Note that one rationale for the existing names is by analogy to
> their C++ equivalents.

C++ libs don't always have the best API. D std.string functions API are
partially modeled on Python string module and this is good. In Phobos there is
now a permutations function that is modelled on C++ equivalent that has a bad
API, and I prefer the range-based permutations/combinations lazy generators
that are more fit and more useful for D that also have the same API as the
equivalent Python generators from the itertools module. So while C++ can
sometimes be a good source for inspiration, other times it is not a good
source, and other sources like Python or Haskell are much better.

I presume the structs/functions you refer to are:

RandomCover/randomCover, RandomSample/randomSample

I think you can drop the Random/random prefix for the second ones:

Sample/sample

because sample from a std.random module is clearly related to sampling.

Regarding randomCover, it's less clear what "cover" means, so you can leave the
"random" prefix if you want.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list