On Fri, 14 Mar 2014 10:00:23 -0400, bearophile <bearophileh...@lycos.com> wrote:

Steven Schveighoffer:

I think it may be best to introduce a new array property:

dest.slength = src.length; // same as dest.length = src.length, but follows D1 rules (slength = stomp length)

If you use slicing (I'm assuming you do), then appending would have to become a function/member instead of ~=.

I can help write those if you want.

Eventually the D1 legacy will go away, so probably it's better to introduce something that later can be removed safely. So instead of "slength" it's better a name like "__slength", to allow its usage only if you compile with the "-d" compile switch (that activates deprecated features) and instead of a built-in array property as "length" it could be better (if possible) to make it a function in the object module as assumeSafeAppend.

I hope you understand that I was not recommending adding this to druntime or phobos. This is not a typical requirement.

Anyone starting with D2 code would use something other than straight array-slices to do this kind of work.

-Steve

Reply via email to