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
1
u/Kaisha001 Jan 26 '26
Well first vec3/4 are not 'gamedev' types, they are linear algebra types. Linear algebra is found everywhere. There's a reason reason why CPUs/GPUs have native linear algebra types and instructions is that is it near ubiquitous across computing.
Linear algebra is used far more than any other field of mathematics apart from basic arithmetic. x86 has SSE/AVX, arm has NEON/SVE/SVE2, PowerPC has VMX/VSX, even the old MIPs line of chips and tiny MCUs like the ESP32 S3 (Tensilica Xtensa vector instructions). They're all basically the same thing, because linear algebra is near universal.
Even GPUs, which are used for FAR MORE than just graphics, and their associated languages, which have wildly different architectures, still have vec3/4 ect... as their base types.
For something so universal and stable, I don't see any good reason for languages to not support them.