Small Vectors Proposal

Andrei Alexandrescu (See Website For Email) SeeWebsiteForEmail at erdani.org
Tue Jan 30 17:16:35 PST 2007


Walter Bright wrote:
> Thank you, this is in line with what I thought you meant. I'm glad I was 
> right. Your proposal is sensible and well thought out.
> 
> The only improvement I'd make is instead of:
> 
> float4 f;
> 
> Have:
> 
> float[4] f;
> 
> i.e. make static arrays of 2,3,4 dimensions have the suggested 
> properties. I think this is quite doable.

I don't think this is advisable. It practically introduces an arbitrary 
discontinuity. Think of a template of T and N that manipulates arrays 
T[N]. All of a sudden, for certain values of T and N, arrays started 
being passed around by value.

What exactly makes small vectors unsuitable for an implementation via 
library elements? If we distill a list, maybe we also can figure ways in 
which we can make the language better, not only one special case of it.


Andrei



More information about the Digitalmars-d mailing list