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

Does indeed still apply, and is actually formalized into the language spec itself [1] in section 7.15.5.1 Captured outer variables. So it's actually a feature (really) in the case of C#, not a bug.

[1] http://www.microsoft.com/en-us/download/details.aspx?id=7029

"the local variable x is captured by the anonymous function, and the lifetime of x is extended at least until the delegate returned from F becomes eligible for garbage collection (which doesn’t happen until the very end of the program)."




I don't see how that part of standard mandates that all anomymous functions share the same closure. The example only has a single lambda.




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

Search: