Is [] mandatory for array operations?

Michel Fortin michel.fortin at
Thu May 6 17:57:07 PDT 2010

On 2010-05-06 19:02:03 -0400, Jason House < at> said:

> Don Wrote:
>>  x[] = sin(y[]);
> I strongly favor the first syntax since it matches how I'd write it in 
> a for loop.
> i.e. I'd replace [] with [i].

This is the best way to see array operations I've read up to now: 
replace [] with [i], i being the current loop index. It's so simple to 

> If there was a sin variant that took array input, then I'd expect the 
> line to be:
>   x[] = sin(y)[]
> which would translate to creating a temporary to hold sin(y) array.

Makes sense too.

Michel Fortin
michel.fortin at

More information about the Digitalmars-d mailing list