On Sat, 1 Nov 2014 14:44:54 +0000 Iain Buclaw via Digitalmars-d <[email protected]> wrote:
> You can clearly see the 'list.length' though. You can't possibly go > off the assumption that if you grow the size of a dynamic array, it's > area in memory won't be relocated. i don't even want to know if that was dynamic or static array! why should i remember that? isn't type checking is what compiler does for us? ;-) dynamic arrays either should not look like static arrays, or should work as static arrays. it's ok for class/struct opAssign() to has some side effects, but it's not ok for built-in things. compiler is perfectly able to at least emit error there. or make that code work as it should work by dereferencing .ptr before doing 'mov' and not before calling `saveIt()`. i don't even want to know about that '.ptr' thing after all. the sample should either consistently not updating the array element, or consistenly updating it, following the principle of the least surprise.
signature.asc
Description: PGP signature
