[phobos] phobos commit, revision 1884

Brad Roberts braddr at puremagic.com
Mon Aug 16 20:33:18 PDT 2010


On 8/16/2010 8:16 PM, David Simcha wrote:
> 3.  Stuff related to static arrays.
> 
> How do we want to handle the static array case, long term?  IMHO stuff in
> std.range and std.algorithm should generally* not *support static arrays because
> in addition to being a PITA to
> implement, since static arrays are usually stack allocated,
> using them as ranges is inherently unsafe.  

In your code they might tend to be stack based, but static arrays inside classes
is a perfectly valid and frequent enough use case (extrapolating from non-d
usage on my part since I've done rather little d coding to date) that I wouldn't
rule them out.

I do agree that for the stack case, there's risk of misuse.  For the safe-d
subset of the language, that's a problem, but phobos isn't restricted to the
subset and so shouldn't go out of its way to make life hard for doing work
outside that subset.

That said, I don't think it's a big burden to push the problem to the developer
to just take a slice over the static array when passing it to a std.algorithm.

My 2 cents,
Brad


More information about the phobos mailing list