5 ms·
If you return a function, the compiler has to bundle up the values of any variables that the function uses from its outer environment and return the whole packa
by jasperry 2y ago
If you return a function, the compiler has to bundle up the values of any variables that the function uses from its outer environment and return the whole package. That's known as a closure. You can't just return a function pointer.
Basically, if you don't return functions, you can avoid dealing with them "escaping" the lexical environment in which their code lives.