Say you have two things (spatial vector, color vector) that are conceptually different (pos in space vs color) yet they actually end up needing the same types of operations - overloaded plus, minus, scalar multiply.
A nice solution in the Cg programming language was they actually aliased member names .xyzw and .rgba. So in Cg you can do
float4 vector = float4( 4, 3, 2, 1 );
float red = vector.r ;
float x = vector.x ;
// both red and x will have the value 4.0.
So the question is: How do you deal with things that are conceptually different but programmatically the same? I could simply use a class Vector and "remember" that .x = .r, .y = .g and so on, which isn't that hard but appears somehow misleading.
The other option is to totally repeat the code in Vector and Color.
Which is better? Repeating code for readability's sake, or just living with the bad naming?