--- Comment #5 from Don <> 2011-11-30 23:03:41 PST ---
> > Consider the case where we want y to be 
> > [ max(x[2][0..$]), max(x[3][0..$]), ... ]
> > 
> > double [][20] x;
> > double [10] y;
> > 
> > Brainstorming a few possibilities:
> > 
> >  y[] = max(x[2..12]);     // (1) looks like scalar assignment
> >  y[] = max[2..12](x);     // (2)
> >  y[] = max(x[2..12])[];   // (3)
> That's ambiguous - maybe max is a function that returns an array or other type
> with an opSlice().

True. But unlike (1), it's still obvious that it's an element-by-element
assignment. The nett effect is the same as if it were vectorized. Is that an
ambiguity that matters? 

> > Can we put the [] _before_ the call? y[] = [] max(x);
> > y[] = x.[]max;
> Would [](expr) be the empty array's opCall(expr) or the vectorisation of the
> function referenced by expr?  And [].func be a vectorisation of the global
> function func or the empty array's .func method?  (Are you envisaging that []
> vectorises a whole subexpression or just the function whose name it 
> immediately precedes?)

I was imagining just the function name. At least, I think it would need to have
very high precedence. []a.b is the same as ([]a).b, rather than [](a.b). This,
[].func would be the empty array's .func method, since there is no function
name before the dot. I think then if you wanted to vectorize .func, you'd do it
as: ".[]func". I'm less sure about [](expr) but I think it would just be an
But I'm really just brainstorming. It's a wild idea. Haven't given any thought
to if it works with function literals or function pointers. 

> FWIW the other week I discovered C++11 variadic templates.  I wonder if we can
> draw inspiration from the unpacking syntax here....

Yeah, that's interesting, it does look quite similar.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to