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
12
u/dcpugalaxy Jan 24 '26
This is very limited. Compilers can't assume your float[4][4] is properly aligned for example. They often can't deal with arrays etc very well because of aliasing. Autovectorisation is very fickle and easy to break.
All serious mathematical libraries have handwritten SIMD. Often assembly but intrinsics are used too.