F. Almeida wrote:
It is an excellent feature of D2 that one can do

double a[];
double b[];
double c[];

//...

c = a[] + 2.0*b[];

But this is still limited, as we cannot include function calls in
these operations.

What if the compiler was able to introduce them in the assignment
loop, provided that the functions pass ref double (in this case)?

double anyfun(ref double x) { ... }

c = anyfun(a[]) + 2.0*b[];

It's not terribly obvious to me that the 'ref' means 'this function can be parallelized'. Also, the function needs to be marked as pure.
Otherwise, that's an interesting syntax.
I do think we need a solution to this, so it's good to keep thinking about. It may be that, for example:

a[] = x * sin(b[])[] + y * cos(b[])[];

will be enough.

Reply via email to