1st draft of complete class-based std.random successor

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Wed Mar 19 17:25:17 PDT 2014


On Thursday, 20 March 2014 at 00:09:51 UTC, bearophile wrote:
> Please don't use stuttering names like 
> "std.random2.randomShuffle". "std.random2.shuffle" is enough.

I don't object to rewriting the names if there's a valid case for 
it, but it does seem to me to be important to try and match as 
much as possible the names that are already out there in 
std.random.  The idea is to minimize the amount of rewriting 
anyone will have to do to adapt their code, and as far as I can 
tell where the contents of std.random2.adaptor are concerned 
(randomShuffle, randomCover, randomSample) it should require no 
rewriting at all.

Besides, while std.random2.adaptor.randomShuffle may be the 
fully-qualified name, in practice, no one will write all that 
out, so the redundancy is less bad; and in any case, as any 
magician will tell you, a shuffle is not necessarily random ;-)

> I don't think the language is yet there. So I think currently 
> this is not a good idea.

If the aim were to overwrite std.random, I would agree with you, 
but there is no need to do that.  It's named std.random2 for a 
reason :-)

However, I do think that merging it into Phobos (assuming all 
other factors are OK) may have to be conditional on improvements 
in the available allocation strategies.


More information about the Digitalmars-d-announce mailing list