View Single Post
Old 11-19-2005, 03:49 AM   #7 (permalink)
KnifeMissile
 
KnifeMissile's Avatar
 
Location: Waterloo, Ontario
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!
KnifeMissile is offline  
 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57