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/slicxx Jan 24 '26
I see where you're going, but more often than not, things are semi-built-in. The title asks why it's not built-in. I assume my definition of built-in is too literal, meaning usable without import. But standard libs (or standardized libs) do often exist and have big functionality.
I think a great example is the C language here. They want to stay minimal and portable, and of course stay close to the machine, only one hop away from ASM. No dynamic vectors exist, because growth handling, memory and error management, performance and so on do matter but in different ways for different use cases. But a simple "type" is one makro or a few lines of header files.
And for the n-D types? Different types (int, float32/64..) can be easily implemented but they would at least need different paddings inside to be efficient in cache.. A Vector3 is used in a widespread use, but in no way are they universal. They are highly domain specific, so let's just keep it in the math library, game engine or shading language which will hopefully be "optimally" compiled for the use case. And these environments all come with the type.
All about hitting the sweet spot between implementing nothing and delivering it all.