3 ms·
Put like this defunctionalisation is just eval for a domain-specific-language that you hope doesn't do the things you don't want it to.
by contravariant 5y ago
Put like this defunctionalisation is just eval for a domain-specific-language that you hope doesn't do the things you don't want it to.
- whitten 5y agoCould 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.
- matheusmoreira 5y agoInstead 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