3 ms·
This is interesting because it seems to operate simultaneously on a contiguous block of memory, as opposed to sequentially on some tree structure. The general c
by JonChesterfield 4y ago
This is interesting because it seems to operate simultaneously on a contiguous block of memory, as opposed to sequentially on some tree structure. The general class of transforms seems to be called 'deforestation'.
Spotting when something can be mutated in place instead of creating a new instance is fairly common. There's a paper that does it at runtime using reference counting and various compilers for functional languages will try to do it ahead of time.
That would roughly lead to updating each element in the array in sequence without making a new array. This is an extension to that when the updates can occur simultaneously which is a more complicated lifetime invariant to recognise.
As an aside, compilers probably should have constraint solvers embedded. Lots of compilation is expressible as a constraint problem.
- nerdponx 4y ago> As an aside, compilers probably should have constraint solvers embedded. Lots of compilation is expressible as a constraint problem. If we had constraint solvers in our compilers, would refinement types also be a lot easier to implement?