Blaming the D language

Jakob Ovrum via Digitalmars-d digitalmars-d at puremagic.com
Tue Oct 21 23:59:02 PDT 2014


On Wednesday, 22 October 2014 at 06:42:06 UTC, Ali Çehreli wrote:
> On 10/21/2014 11:06 PM, thedeemon wrote:
>
>>     A[B] freshCleanAA;
>>     aa = freshCleanAA;
>>
>> (where A[B] denotes the type of aa)
>> That's it!
>
> Alternative:
>
>     A[B] aa;
>     aa = aa.init;
>
> Ali

`aa.init` is just `null`, which illustrates the problem better:

     int[string] aa = ["foo": 42];
     int[string] aaAlias = aa;
     aa = null;
     assert("foo" !in aa); // Ostensibly cleared...
     assert(aaAlias["foo"] == 42); // Until aliasing is introduced.


More information about the Digitalmars-d mailing list