digitalmars.D.bugs - [Issue 9106] New: Rename std.random.randomShuffle as std.random.shuffle
- d-bugmail puremagic.com (22/33) Dec 02 2012 http://d.puremagic.com/issues/show_bug.cgi?id=9106
- d-bugmail puremagic.com (13/13) Dec 02 2012 http://d.puremagic.com/issues/show_bug.cgi?id=9106
- d-bugmail puremagic.com (10/14) Dec 03 2012 http://d.puremagic.com/issues/show_bug.cgi?id=9106
- d-bugmail puremagic.com (11/11) Apr 01 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9106
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
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: -------
Dec 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
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: -------
Dec 02 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9106
monarchdodra gmail.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |monarchdodra gmail.com
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: -------
Dec 03 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9106
Luís Marques <luismarques gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |luismarques gmail.com
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: -------
Apr 01 2013









d-bugmail puremagic.com 