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
5
u/dcpugalaxy Jan 24 '26
vec2, vec3, and vec4 are reasonable to support. Anything else is unreasonably niche. They aren't useless but anything outside 2/3/4 is niche in comparison. Seems like a pretty clear natural limit to me. I would hardly say vec4/mat4 is niche. They're widely used in computer graphics.
I think the best reason to have them built in is that they're natural vocabulary types. Lots of different libraries and types of libraries want to use and talk about vectors. Having a separate type in each library which are all essentially the same kinda sucks.