News for hackers. Stuff that matters.
Re:Defunctionalization: Everybody does it, nobody talks abou... by whitten on Friday August 06, 2021 @07:51PM (#28094169)
Could you clarify this, and give an example? This is an intriguing idea of eval that gets limited kinds of expressions, whether from defunctionalization or for security reasons.
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