문제

I'm reading about C# and closure, various articles, Jon Skeet's awesome "C# in Depth" and I see statements like "C# and ruby implement lexical closure".

Why do the authors include the word "lexical"? Why not just say they "implement closure"?

What would it mean if it just implemented "closure", and not "lexical closure (if that's even possible)?

도움이 되었습니까?

해결책

Lexical closure is just a more specific name for closure.

As you know, a closure allows a function to use variables from the scope where it was created, even if is executed from a different scope. Such a scope is also called a lexical environment, and that's where the term lexical comes from here.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top