r/ProgrammingLanguages • • 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

132 comments sorted by

View all comments

Show parent comment

1

u/JeffB1517 Jan 25 '26

No they don't. They treat them as objects with properties

ls d/e is effectively a polymorphic function of d which is then polymorphic on e which is treated as an object i.e. d->e.ls in OO syntax. Note that e is a file ls polymorphism will handle this. Similarly cat d/e now treats e as a file and d->e.cat. It has elegant failure if e is a directory. Etc... that is way more than strings.

More importantly though, than all that power is the fact that they are a default argument type, a primitive, for countless operations that want a file name, not merely a string.

-1

u/shponglespore Jan 25 '26

Umm... arguments to processes are passed as strings, bro. ls and cat are programs, not member functions.

3

u/JeffB1517 Jan 25 '26

Arguments are passed to C as strings. That doesn't mean they are considered strings in the context of the shell language. type is a builtin. The primitives it supports are: ‘alias’, ‘keyword’, ‘function’, ‘builtin’, or ‘file’. String is not there.