Skip to content

Comment on The Yin and Yang of Programmingparent

Comments

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.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.