5 ms·
The problem is not that the array is mutable, but that the size of the array may differ for different strings. (In fact, it usually* does differ if the string l
by J-Kuhn 2mo ago
The problem is not that the array is mutable, but that the size of the array may differ for different strings. (In fact, it usually* does differ if the string length is different).
This makes it impossible to flatten - as the VM needs to know the total size when creating the memory layout for a class...
* (with a small exception: if the strings use different coders, one can be twice as long and the backing arrays would still have the same size)
- DarkNova6 2mo agoIndeed. At this point you’d need to bring the size of the string into the type system (C++ Templates we meet again!) but then you look at a solution worse than the problem…