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

I've always referenced this as one of the subtle points of genius for how Java did lambdas:

by requiring captured variables to be final it removes a lot of ambiguity around what a variable name refers to. I like that local variables can only be changed locally. If you do want crosstalk between the inner and outer scopes you have to be more explicit and introduce a reference to talk through.

I love python, but I basically avoid this construction and use a single element list if I need it. I can never remember exactly how it works.




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

Search: