seeding the pot for 2.0 features [small vectors]

Bill Baxter dnewsgroup at billbaxter.com
Sun Jan 28 19:38:13 PST 2007


Chad J wrote:
> Bill Baxter wrote:
>> Mikola Lysenko wrote:
>>
>>> Bill Baxter wrote:
>>>
>>>> Mikola Lysenko wrote:
>>>>
>>>>> 2. Low dimensional vectors as primitive types
>[...]

>>
>>      float[4] v = a*b + c*d;
>>
>> you can even make aliases if you like.
>>
>>      alias float[4] float4;
>>
>> But your 3D graphics library will still need to be a library on top of 
>> that.
> 
> Yeah I mentioned static arrays earlier, but I realized that they can be 
> a bit of a pain in the ass to work with.  This probably means that 
> static arrays should be fixed, then they could be useful vectors. 

Agreed.  So basically the D 2.0 wish list item becomes to make float[4] 
act more like a plain-old-data value type, give it simple math 
operations, optimize the heck out of it, and make it possible to alias 
it to float4 for convenience.

And maybe add the .xyzw accessors and swizzles too. :-)

I suspect the "optimize the heck out of it" step will be a long time 
coming though.  Probably more like D 3.0.

--bb



More information about the Digitalmars-d mailing list