> 1) In you example you are writing this with normal arrays: > > A[0].X := 0; > > And in my implementation it's exactly the same. Regarding writing the entire > type directly > > A[0]^ := V; > > If using the caret symbol ^ or an Item property is a deal breaker, then this > can be simplified using a custom smart pointer type similar to how the > aligned array type was implemented resulting in the same syntax as in the > first example.
Yes, returning temporary smart pointer would do the trick. -1 syntax incompatibility then. I see this as a definite improvement. > 2) As I've implemented them aligned array is compatible with dynamic arrays. > They implicitly convert between the two with no loss of data. If you truly > want to share the data within each, then you can define functions to work on > referencing the data types they hold, allowing the same function to serve > either type. Well. Converting arrays is too slow to be usable, imho. Think about textures, vertex buffers, etc. > > For example: > > procedure VectorTransform(Matrix: TMat4; FirstVertex: PVec3; Count: Integer); > > and then > > Matrix.Rotate(12.5, 0, 0); > VectorTransform(Matrix, AlignedData[0], AlignedData.Length); > VectorTransform(Matrix, @DynamicArray[0], Length(AlignedData)); > > Or you can even overload VectorTransform if you don't want to see @ symbols. > > procedure VectorTransform(Matrix: TMat4; FirstVertex: var TVec3; Count: > Integer); overload; It's all right and will eventually work. But you miss much larger problem - that will require a lot of boilerplate/conversion/manual work. Think about mixing 3 graphical libraries using different array/matrix/vertex types. Instead of re-using each others code, one would eventually write 4th library. FPC community is too small to afford such useless combinatorics. > > 3) Regarding Hi, Lo, Length, I prefer to put these functions on types. For > example > > for I := A.Lo to A.Hi do A[I].X := I; > > Is that such a deal breaker? Yes. Generics / generic functions is a big deal. That would need two different functions for each different _array_ type. -- Regards, Denis Golovan _______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel