2 ms·
I can't help but wonder if mutability and aliasing are secretly the same thing. For example, we can't optimize memcpy by reordering reads if the source and dest
by cousin_it 12y ago
I can't help but wonder if mutability and aliasing are secretly the same thing. For example, we can't optimize memcpy by reordering reads if the source and destination arrays are aliased. But if we had a hypothetical language where arrays can be mutable or immutable, we could require the source array to be immutable and the destination array to be mutable. Then we'd be able to reorder reads just fine, because writing to the mutable destination array can't affect the immutable source array!