Hacker News new | ask | show | jobs
by Joker_vD 17 hours ago
Eh, or that, I guess. I personally would rather not squish the type of the elements together with the dimensions, but it can work like that, sure. Especially if you use square brackets for generic instantiation, so your example is semantically close to std::array<char*, 10> of C++. But if the language uses the square brackets (almost) exclusively for array indexing, then having simply "[10]" prefix as a shorthand for "array of 10 of ..." à la Zig/Go is quite reasonable. Then again, Go does use square brackets both for instantiation of generics and for array-related operations so... I guess they had the syntax of map types as a precedent.
1 comments

> Especially if you use square brackets for generic instantiation, so your example is semantically close to std::array<char*, 10> of C++.

Yes, it is like that.