2 ms·
> Why do rust arrays have to have a size known at compile time? Having a known-length array type in a programming language: * allows the compiler to make cert
by nsajko 6y ago
> Why do rust arrays have to have a size known at compile time?
Having a known-length array type in a programming language:
* allows the compiler to make certain optimizations using the information it has on the length, especially if the length is small
* allows the programmer to enforce constraints on the length of arrays at compilation time, which can make program correctness more evident and easier to accomplish
> This restriction is not found in other programming languages.
Ever heard about C or C++ or Go? Even dynamic languages like Julia allow defining such types.