Inability to dup/~ for const arrays of class objects

Maxim Fomin maxim at maxim-fomin.ru
Thu May 30 09:23:51 PDT 2013


On Thursday, 30 May 2013 at 15:50:37 UTC, Ali Çehreli wrote:

> Your definition of "correct" depends stems from the fact that 
> it is what the spec says. If we take the spec as the final 
> word, you are right. However, there are historical reasons why 
> terminology sometimes lag behind reality and sometimes never 
> change.

There is no thing as my definition. It a spec definition. It has 
higher priority over any POV, especially when it comes from 
nowhere, without explaning why it is correct and why it is wrong, 
except long description how D runtime works which is pretty 
irrelevant. I would not comment anything else which is based on 
disagreement between slice and dynamic array. Note, that there is 
no problem with alising of slice and dynamic array, but there is 
problem with denying that dynamic array (according to spec) is a 
slice.

> dynamic may mean:
>
> * happens at run-time
>
> * sits on the heap

I provided code when it sits in stack (slice according to the 
article). So, any novice who thinks that dynamic means runtime 
memory can run into bugs (what actually happens). And as was 
mentioned previously, article definition has some kind of 
contribution to dilution between memory types and array types.

> * resizable
>
> * does not have automatic duration
>
> * more?
>
> static may mean:
>
> * initialized at compile time
>
> * sits on the stack

I provided code where static array is on the heap. So, making 
definition that static array are stack allocated do not express 
reality of things. However it is unlikely to lead to bugs.


More information about the Digitalmars-d mailing list