On Mar 5, 2014, at 7:35, Steven D'Aprano firstname.lastname@example.org wrote:
So as you can see, what I've been calling a thunk is not precisely like Algol thunks. One thing which is missing is the dynamic scoping: in the thunk evaluation, the x comes from the caller's scope. But the delayed evaluation part is quite similar, enough that I think the name may be appropriate. Another name for this might be a "promise", as in the promise to execute a computation later.
As I mentioned in one of the previous threads, Alice does lazy evaluation with futures and promises--the same construct it uses for concurrent scheduling, closely related to what Python has in concurrent.futures (Python merges futures and promises into a single object with two different APIs, but the idea is the same).
If `expr` evaluated to an object with the same API as a concurrent.futures.Future, that's not a terrible form of explicit evaluation. But if it's doing something like dynamic scoping, it might look pretty misleading.