Fields : Types vs 'normal'

BlitzMax Forums/BlitzMax Beginners Area/Fields : Types vs 'normal'

Pro:

You could add vector functionality to the vector type. This would otherwise need to be external functions which isn't as clean as objects.

Con: you have a little overhead due to the "object" part.


Way one needs a little prethinking:

1. You need pooling. Without it you will kill your app most likely (there is a very usefull thread somewhere on the boards on optimizing)

2. Its highly suggested to implement 2 versions of all operations. an "in-situ" version (that changes the object itself) and a return version that returns a resulting vector which holds the data of the operation.
Reason here is that there are cases where you need a result and cases where you want to modify the current. (for example normalize is such a functionality that needs both normally. once where the vector itself is changed and once where you need the normalized vector for vector projection and the like)