Quote:
Originally Posted by JinnKai
I've never really found a good explanation for why they re-used a perfectly good term for things with a magnitude and a direction to mean "a dynamic array," so I'll agree with you there.
However, couldn't you use namespaces, such as use mynamespace; instead of STL so that Vector is recognized as YOUR vector, rather than the STL vector? The entire purpose of a namespace is to prevent this type of naming conflict, isn't it?
|
You misunderstand my complaint. I'm not afraid of a name conflict, I'm afraid of confusing the readers of my code with ambiguous variable names. So, for instance:
Code:
ContinuousFunction AffineTransform::Apply(ContinuousFunction vector) {
return mFactorField * vector + mTranslationVector;
}
Someone reading this might mistake the various vectors in this function to be STL vectors and there's nothing about namespace or C++ that can fix this! Now, while this is a rather contrived example, I hope you can see that this can seriously limit how you'd like to name your mathematical routines, especially if you're trying to write clean and self-documenting code!
...and for what? In what manner is std::vector a vector? It's a rather non-descriptive name.
Not to mention that I have a few other complaints about the STL naming conventions--along those same lines!