Hacker News new | past | comments | ask | show | jobs | submit login

Right. And of course the whole idea is prone to insane amounts of fail.

    > Thus, if you access the enclosing environment, you
    > must ensure that the lifetime of this lambda is bound by the
    > lifetime of the enclosing environment (i.e., until the enclosing
    > function returns).  This means that if you access local
    > variables, bad things will happen.  If you don't access local
    > variables, you're fine.
Might as well avoid the complications, hoist the function and pass a function pointer with some context (assuming it's needed).



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: