[Issue 9106] New: Rename std.random.randomShuffle as std.random.shuffle

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Dec 2 11:36:59 PST 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 at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at 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: -------


More information about the Digitalmars-d-bugs mailing list