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

Every implementation of a closure I've encountered creates a new Capture class which stores references/copies of all variables the closure uses. I think they do this even if the closure doesn't reference any local variables - only class-level ones. In this case, wouldn't it be better to just implement it as a local function of the parent class instead of creating a new class? Or does it not matter because the cost of calling this.foo is negligibly similar to this.parent.foo?



Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: