← Back to context

Comment by akfred

16 days ago

> No. The code is completely consistent: the closures are different instances of a function that returns the value of 'number' at the moment it gets called. Not the value of 'number' when it gets created.

Isn't that exactly what GP said? And gave an example how to create that effect explicitly in functional languages, using refs?

Yes. But I found the explanations of the GP a little misleading, especially the eager/lazy part.