r/ProgrammingLanguages • u/Luroqa • Jan 24 '26
Discussion Why don't any programming languages have vec3, mat4 or quaternions built in?
Shader languages always do, and they are just heaven to work with. And tasty tasty swizzles, vector.xz = color.rb it's just lovely. Not needing any libraries or operator overloading you know? Are there any big reasons?
110
Upvotes
View all comments
Show parent comment
51
u/HaMMeReD Jan 24 '26
Vectors/Matrix math is low hanging fruit for low level optimizations at the compiler. I.e. SIMD instructions and vectorization.
The fact is that the language having the semantics means it can optimize more effectively at the hardware level to use those features.
If it's just an add-on to the language, the semantics are not there for the compiler that it can use the enhanced instructions available to operate on those types.