July 01, 2003
On Mon, 30 Jun 2003 19:00:48 +0000 (UTC), Mark Evans <Mark_member@pathlink.com> wrote:
> 
> The question is really, Why use square brackets for so many purposes?  Any syntax element with multiple meanings will be painful.  In C and D alike, square brackets both declare and index arrays.  The confusion grows in D with the proliferation of arrays:  VLA's, associative array declarations, strings, and slicing.  D is overloading the [] syntax beyond reasonable limits.
> 
> One can hack through the undergrowth in a simple way.  Separate type declarations from indexing.  Reserve [] for indexing and slicing only.  There are other ways to declare types.
> 
> A phrase like 'array(int,N,fixed)' could declare an N-dimensional array of int,
> 'array(double,N,variable)' a VLA of doubles with initial size N.  A mixed case
> might read 'array(array(int,N,fixed),M,variable)'.  If you don't like these
> notions, invent your own.  There are no limits except to keep [] out of the type
> declarations.
> 
> If D is finally going to break with C syntax (hooray), then go all the way and do it right.  I'm not holding my breath, but that would be my input.
> 
> Mark
> 
Nice idea!
I would prefer to not make it look like a function:

farray N of int
varray N of double
varray M of farray N of int

Karl Bochert