News for hackers. Stuff that matters.
Re:Grids in Rust, Part 2: const generics by nsajko on Saturday April 03, 2021 @02:47PM (#26683597)
> 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.

There are no comments on this comment yet.