• Ivan Senji (37/37) Feb 07 2006 Here i will ask a question, and then answer it the way I think Walter
• Don Clugston (5/57) Feb 07 2006 I think so. Read
• Ivan Senji (5/9) Feb 07 2006 I remember that proposal but it was very long time ago, and it gave hope...
Ivan Senji <ivan.senji_REMOVE_ _THIS__gmail.com> writes:
```Here i will ask a question, and then answer it the way I think Walter

I would like to create a dynamic but rectangular array (example not D
syntax):

<example1>

int[,,,,] array = new int[10,7,5,3,2];
array[x,y,z,w,t] = 100;

</example1>

Question: how or when will this be available in D?

But you can already to the same thing in D, just write:

<example2>

int[][][][][] array = new int[][][][10];

for(int i=0; i<10; i++)
{
array[i].length = 7;
for(int j=0; j<7; j++)
{
array[i][j].length = 5;
for(int k=0; k<5; k++)
{
array[i][j][k].length = 3;
for(int l=0; l<3; l++)
{
array[i][j][k][l].length = 2;
}
}
}
}

and then:

array[x+y*10+z*10*7+w*10*7*5+t*10*7*5*3] = 100; //maybe correct

</example2>

Although i agree that the code in these two examples looks almost
identical and can hardly imagine why anyone would wan't to write the
first one :) , there may be people who think the first is just a little
bit simpler.

Is something like this even a remote posibillity for 2.0 D?
```
Feb 07 2006
Don Clugston <dac nospam.com.au> writes:
```Ivan Senji wrote:
Here i will ask a question, and then answer it the way I think Walter

I would like to create a dynamic but rectangular array (example not D
syntax):

<example1>

int[,,,,] array = new int[10,7,5,3,2];
array[x,y,z,w,t] = 100;

</example1>

Question: how or when will this be available in D?

But you can already to the same thing in D, just write:

<example2>

int[][][][][] array = new int[][][][10];

for(int i=0; i<10; i++)
{
array[i].length = 7;
for(int j=0; j<7; j++)
{
array[i][j].length = 5;
for(int k=0; k<5; k++)
{
array[i][j][k].length = 3;
for(int l=0; l<3; l++)
{
array[i][j][k][l].length = 2;
}
}
}
}

and then:

array[x+y*10+z*10*7+w*10*7*5+t*10*7*5*3] = 100; //maybe correct

</example2>

Although i agree that the code in these two examples looks almost
identical and can hardly imagine why anyone would wan't to write the
first one :) , there may be people who think the first is just a little
bit simpler.

Is something like this even a remote posibillity for 2.0 D?

http://homepages.uni-regensburg.de/~nen10015/documents/D-multidimarray.html
Walter said it was a good proposal. It will definitely not be in 1.0
(even array operations, which are in the spec, will not be in 1.0 AFAIK).
```
Feb 07 2006
Ivan Senji <ivan.senji_REMOVE_ _THIS__gmail.com> writes:
```Don Clugston wrote: