https://issues.dlang.org/show_bug.cgi?id=15982
--- Comment #4 from sigod <[email protected]> --- (In reply to ag0aep6g from comment #3) > (In reply to sigod from comment #2) > > It's meaningless for dynamic arrays. > > Currently std.array.array guarantees one level of duplication. So when I > call it on an int[], I can rely on the new array being independent from the > original one. I can alter elements without affecting the original. I can > cast it to immutable(int)[] without running into undefined behavior when the > original is altered. One of the first things that I learned in D is that you have `dup` and `idup` "properties" for this. I bet no one uses `array()` for duplicating arrays. > I'm not saying that this is the best behavior for a function called "array", > but that's how it's documented and how it works. Changing it now would be a > serious breaking change. Function called `array` for a reason. Because it gives you array where you have only an input range. It doesn't make sense to do anything if you already have an array. In normal code you will never call `array` for array. --
