April 16, 2009
Lars Kyllingstad Wrote:

> I am writing a D library based some of the stuff in SLATEC, and I've come to a point where I need to decide on a way to manipulate vectors and matrices. To that end, I have some ideas and questions I would like comments on from the community.
> 
> My first question goes to those among you who do a lot of linear algebra in D: Do you think supporting both library  types and arrays is worth the trouble? Or should I just go with one and be done with it?
> 
> 
> A user-defined matrix type would have opIndex(i,j) defined, and to retrieve elements one would write m[i,j]. However, the syntax for two-dimensional arrays is m[i][j], and this means I have to put a lot of static ifs around my code, in order to check the type every time I access a matrix. This leads me to my second question, which is a suggestion for a language change, so I expect a lot of resistance. :)
> 
> Would it be problematic to define m[i,j,...] to be equivalent to m[i][j][...] for built-in arrays, so that arrays and user-defined types could be used interchangeably?
> 
> (And, importantly, are there anyone but me who think they would benefit from this?)
> 
> 
> -Lars

If your looking for votes you have mine. I'd like to see a consistent interface for multidimensional rectangular arrays using the m[i,j,k,...] syntax. I know we've got people, like yourself, to provide implementations.

Paul