Thread overview
[Issue 9106] New: Rename std.random.randomShuffle as std.random.shuffle
Dec 02, 2012
Jonathan M Davis
Apr 01, 2013
Luís Marques
December 02, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9106

           Summary: Rename std.random.randomShuffle as std.random.shuffle
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody@puremagic.com
        ReportedBy: bearophile_hugs@eml.cc


--- Comment #0 from bearophile_hugs@eml.cc 2012-12-02 11:36:58 PST ---
I suggest to rename the function "std.random.randomShuffle()" to just "std.random.shuffle()". There is no other "shuffle" name in Phobos. And one of the points of the module system is to avoid prefixes like that.

Othrwise why the other funtions aren't named randomUniform, randomRandom, etc?

See also what the Python Pep8 says about this topic:

> There's also the style of using a short unique prefix to group related names together. This is not used much in Python, but it is mentioned for completeness. For example, the os.stat() function returns a tuple whose items traditionally have names like st_mode, st_size, st_mtime and so on. (This is done to emphasize the correspondence with the fields of the POSIX system call struct, which helps programmers familiar with that.)
> 
> The X11 library uses a leading X for all its public functions. In Python, this style is generally deemed unnecessary because attribute and method names are prefixed with an object, and function names are prefixed with a module name.


The old name should be left as deprecated alias for some time.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 02, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9106


Jonathan M Davis <jmdavisProg@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jmdavisProg@gmx.com


--- Comment #1 from Jonathan M Davis <jmdavisProg@gmx.com> 2012-12-02 11:44:29 PST ---
Due to the issues regarding random number generator ranges being value types instead of reference types, there's a decent chance that we're going to end up with a std.random2 in the semi-near future. It would make sense to make this sort of change when we do that.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 03, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9106


monarchdodra@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |monarchdodra@gmail.com


--- Comment #2 from monarchdodra@gmail.com 2012-12-03 13:56:02 PST ---
(In reply to comment #1)
> Due to the issues regarding random number generator ranges being value types instead of reference types, there's a decent chance that we're going to end up with a std.random2 in the semi-near future. It would make sense to make this sort of change when we do that.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 01, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9106


Luís Marques <luismarques@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |luismarques@gmail.com


--- Comment #3 from Luís Marques <luismarques@gmail.com> 2013-04-01 07:34:37 PDT ---
Let me add that I too was surprised when shuffle() didn't work, and by looking
at the docs discovered that the correct name was randomShuffle().

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