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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu May 3 14:06:16 PDT 2012


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


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jmdavisProg at gmx.com
           Severity|enhancement                 |normal


--- Comment #1 from Jonathan M Davis <jmdavisProg at gmx.com> 2012-05-03 14:07:29 PDT ---
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.

It looks like the problem is that randomShuffle doesn't have a template
constraint (obviously not good), so I very much doubt that it was ever intended
to work with static arrays without slicing. uninformDistribution (which is
right above randomShuffle) appears to have the same problem.

I'd say that this is definitely a bug, not an enhancement. If I remember, I'll
probably throw together a pull request for it tonight, since it should be a
quick fix.

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