I’m surprised this doesn’t already exist. I don’t have much experience with Swift, but I heard they’re going to use it instead of C++ for Ladybird. I’d have thought a language that doesn’t care to distinguish inline vs. heap-allocated arrays is pretty high level for a browser.
It’s not that common to need a size-fixed-at-compile-time array. In C++ I don’t reach for std::array super often. For common cases like Cartesian coordinates Swift already has tuples.
Semantically, no. From optimization perspective, quite a bit. Typical C code is full of buf[MAX_LEN], which is great for buffer overflows, but also great for avoiding temporary allocations.
LLVM codebase uses SmallVector and SmallDenseMap everywhere.
I’m surprised this doesn’t already exist. I don’t have much experience with Swift, but I heard they’re going to use it instead of C++ for Ladybird. I’d have thought a language that doesn’t care to distinguish inline vs. heap-allocated arrays is pretty high level for a browser.
It’s not that common to need a size-fixed-at-compile-time array. In C++ I don’t reach for std::array super often. For common cases like Cartesian coordinates Swift already has tuples.
Semantically, no. From optimization perspective, quite a bit. Typical C code is full of
buf[MAX_LEN], which is great for buffer overflows, but also great for avoiding temporary allocations.LLVM codebase uses
SmallVectorandSmallDenseMapeverywhere.