Thread overview
why no .dup for associative arrays?
Dec 12, 2004
no
Dec 13, 2004
Walter
December 12, 2004
int main()
{
int[int] map, m2;

map[0]++;

m2 = map.dup;

return 0;
}

map.d:7: no property 'dup' for type 'int[int]'

What's the reason for this, why associative array is different from other objects?


December 12, 2004
no@where.com wrote:

> map.d:7: no property 'dup' for type 'int[int]'
> 
> What's the reason for this, why associative array
> is different from other objects?

There is no static init for AA either, I think (guess)
one reason is that the internal format is not fixed ?

So it's probably a "bug". Probably known, but anyway.

--anders
December 13, 2004
<no@where.com> wrote in message news:cpi6p0$2lik$1@digitaldaemon.com...
> int main()
> {
> int[int] map, m2;
>
> map[0]++;
>
> m2 = map.dup;
>
> return 0;
> }
>
> map.d:7: no property 'dup' for type 'int[int]'
>
> What's the reason for this, why associative array is different from other objects?

Essentially because it never occurred to me :-(

The .dup would come in handy for some kinds of lock-free data structures.