[Issue 11082] std.algorithm.join of a dynamic array of fixed-size arrays

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Sep 21 06:37:50 PDT 2013


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



--- Comment #3 from Peter Alexander <peter.alexander.au at gmail.com> 2013-09-21 06:37:47 PDT ---
(In reply to comment #2)
> (In reply to comment #1)
> > I'm not sure if this is a valid enhancement. I'm not a fan of making special
> > allowances for static arrays.
> 
> C++, Ada and Rust languages show that if you want an efficient system language
> you should encourage and help programmers avoid dynamic allocations where
> possible. Fixed sized arrays help reduce heap allocations, and they should be
> supported as much as possible by Phobos, instead of making them second-class
> citizens. It's not a problem of those arrays, it's a problem of the Range
> abstraction.

I agree, and I use static arrays all the time, so I understand your
frustrations. However, they are not second class citizens, at least not anymore
than Array, SList, or any other container. The issue is that dynamic arrays are
more than first-class citizens, they are a freak type that is strange
combination of container and range.

I do not look forward to having to write special overloads for every
range-operating function that also accepts containers. It is impractical and a
maintenance nightmare. There needs to be a better solution, so I would suggest
we either find a way of automating this transform, or just live with the minor
inconvenience of working with containers instead of ranges.

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