Defunctionalization とは?
defunctionalization は、各関数値を個別のデータコンストラクタとして表し、すべての呼び出しをコンストラクタで pattern match する 1 つの apply 関数を通すことで、高階関数を除去するプログラム変換です。関数だった振る舞いは、データと中央のディスパッチャになります。結果として、関数を値に取る引数のない一階のプログラムが得られます。
なぜ重要か
defunctionalization により、高階のコードを第一級関数のない言語やターゲットへコンパイルでき、取りうる振る舞いの集合を明示できます。コンパイラやプログラム全体解析で有用な手法です。
関連ガイド
What Is Closure Conversion?Closure conversion is a compiler transformation that turns nested functions capturing variables into plain fu…
What Is a Higher-Order Function?A higher-order function takes other functions as arguments or returns a function as its result, treating beha…
What Is Pattern Matching?Pattern matching inspects a value against a set of shapes, selecting a branch and binding parts of the value…