http://d.puremagic.com/issues/show_bug.cgi?id=11082
--- Comment #2 from [email protected] 2013-09-21 06:14:46 PDT --- (In reply to comment #1) > join works on a range of ranges, but here you have a range of static arrays, > which are not ranges. I don't care how you call those things inside the outer array, I call them "fixed sized arrays", they are language built-ins, and sometimes I have had to collect them in a larger dynamic array. I have written a join function to join them in my own code, and I think such functionality should be present in Phobos. I see no good reason to keep such so basic functionality out of Phobos and inside my own libraries. Workarounds like this one are a waste of efficiency and they are noisy: import std.algorithm: join; import std.stdio, std.algorithm; void main() { int[2][] data = [[1, 2]]; data.map!q{ a[] }.join.writeln; } Also, that code doesn't work, you could avoid that trap with a dup: import std.algorithm: join; import std.stdio, std.algorithm; void main() { int[2][] data = [[1, 2]]; data.map!(a => a.dup).join.writeln; } > 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. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
