Recently i had a case where I would have needed integer-typed vectors.
Because I am generally underwhelmed by the flexibility of the vl vector types, I thought I might look into how a more flexible solution would look like.
I started off with c#, and tried to model something involving generics. Also, I wanted to take an extra idea for a spin: setting the vector size itself by using generics.
To my surprise, this was easily possible.
i found a few things on the way:
- structs are not a good thing to found a generic vector solution on, but classes can be made immutable too. they just need extra care.
- transfering all the sharpdx utils in a more generic way is a lot of work
- using generic composition (ironically through structs) can remove reliance on inheritance
after that I booted up alpha35.9 and started importing.
I imported Types first (Forwards?), per drag&drop from the vl solution explorer, and pretty soon realized, that my c# convenience types (mainly classes, that inherit from the most basic vector type) are of no use, because type inferrence will not work anymore. I guess because the generics are not directly mentioned in the class signature anymore.
Unfortunately I also had to open up the ctor and pass in the “vector size”, this was not necessary with c#.
Also, at this point I still don’t know how to best model operations…
But when used consistently as generic as possible, a pipeline can be build up, I think.
I upload the git history here to, in case you like to have a look at some steps on the way.
Vector.zip (115.6 KB)
this upload is licensed with MIT so go ahead and tinker with it freely.
of course any feedback and involvement is welcome, hopefully even collaboration large enough for the endevour