question about passing associative array to a function

2014-05-11 Thread rbutler via Digitalmars-d-learn
I have searched and can not understand something about passing AAs to a function. I have reduced the gist of the question to a tiny program below. If I put ref in the function stmt it works, i.e.: ref int[int] aa My confusion is that AAs are supposed to be passed as refs anyway, so I

Re: question about passing associative array to a function

2014-05-11 Thread John Colvin via Digitalmars-d-learn
On Sunday, 11 May 2014 at 14:46:35 UTC, rbutler wrote: I have searched and can not understand something about passing AAs to a function. I have reduced the gist of the question to a tiny program below. If I put ref in the function stmt it works, i.e.: ref int[int] aa My confusion is

Re: question about passing associative array to a function

2014-05-11 Thread rbutler via Digitalmars-d-learn
On Sunday, 11 May 2014 at 15:22:29 UTC, John Colvin wrote: On Sunday, 11 May 2014 at 14:46:35 UTC, rbutler wrote: I have searched and can not understand something about passing AAs to a function. I have reduced the gist of the question to a tiny program below. If I put ref in the function

Re: question about passing associative array to a function

2014-05-11 Thread Ali Çehreli via Digitalmars-d-learn
On 05/11/2014 07:46 AM, rbutler wrote: I have searched and can not understand something about passing AAs to a function. I have reduced the gist of the question to a tiny program below. If I put ref in the function stmt it works, i.e.: ref int[int] aa My confusion is that AAs are

Re: question about passing associative array to a function

2014-05-11 Thread John Colvin via Digitalmars-d-learn
On Sunday, 11 May 2014 at 16:54:18 UTC, Ali Çehreli wrote: On 05/11/2014 07:46 AM, rbutler wrote: I have searched and can not understand something about passing AAs to a function. I have reduced the gist of the question to a tiny program below. If I put ref in the function stmt it works,

Re: question about passing associative array to a function

2014-05-11 Thread Ali Çehreli via Digitalmars-d-learn
On 05/11/2014 10:00 AM, John Colvin wrote: On Sunday, 11 May 2014 at 16:54:18 UTC, Ali Çehreli wrote: On 05/11/2014 07:46 AM, rbutler wrote: I have searched and can not understand something about passing AAs to a function. I have reduced the gist of the question to a tiny program

Re: question about passing associative array to a function

2014-05-11 Thread Jonathan M Davis via Digitalmars-d-learn
On Sun, 11 May 2014 17:00:13 + Remind me again why we can't just change this to a sensible initial state? Or at least add a .initialize()? All reference types have a null init value. Arrays and classes have the exact same issue as AAs. Anything else would require not only allocating memory

Re: question about passing associative array to a function

2014-05-11 Thread ed via Digitalmars-d-learn
On Sunday, 11 May 2014 at 14:46:35 UTC, rbutler wrote: I have searched and can not understand something about passing AAs to a function. I have reduced the gist of the question to a tiny program below. If I put ref in the function stmt it works, i.e.: ref int[int] aa My confusion is