Re:Defunctionalization: Everybody does it, nobody talks abou...
by matheusmoreira on Friday August 06, 2021 @08:50PM
(#28094584)
Instead of having a function that can accept an arbitrary function as parameter, the compiler enumerates all known uses of the function into a data type and uses that as input instead. The resulting code is no longer general purpose.
It's as if you gave Intel your program and they produced a special optimized processor that runs just the instructions found in your program and nothing else.
> the insight of defunctionalization is to find all actual uses of the higher-order function
> Each distinct use of the filter function yields a new case in the Filter datatype
It's as if you gave Intel your program and they produced a special optimized processor that runs just the instructions found in your program and nothing else.
> the insight of defunctionalization is to find all actual uses of the higher-order function
> Each distinct use of the filter function yields a new case in the Filter datatype