[Issue 8026] Fix or disallow randomShuffle() on fixed-sized arrays

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri May 11 13:26:36 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8026


Vidar Wahlberg <canidae at exent.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |canidae at exent.net


--- Comment #3 from Vidar Wahlberg <canidae at exent.net> 2012-05-11 13:27:59 PDT ---
(In reply to comment #1)
> Well, that's certainly weird. Range-based functions don't normally take static
> arrays, and I'd argue that they shouldn't, given the problems surrounding
> slicing static arrays (it's fine to do it, but you need to be aware of what
> you're doing) - though randomShuffle doesn't have the same problem as most
> range-based functions do with static arrays given that it's void. Still, I'd
> argue that it's probably better for it to require slicing like all the rest.

Are the problems surrounding slicing static arrays easily explainable?

>From my point of view (fairly new to the language) it's confusing that you can
pass a dynamic array to a Range-based function, while you'll need to slice a
static array if you want to pass that data to a such function.
To me it seems more user friendly if you could pass even static arrays to such
method, but I presume there's a good reason why this is avoided. I haven't
quite managed to figure out this yet, any pointers would be appreciated.

-- 
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