You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The proposal is that when you write, in global context, something like this:
[ f(x,α,β,γ) for x in itr ]
This actually means this:
let f = f, α = α, β = β, γ = γ
[ f(x,α,β,γ) for x in itr ]
end
The idea is based on the theory that the evaluations of comprehension expressions are independent and implicitly concurrent. Thus, even if the bindings of the global variables f, α, β and γ are changed by the evaluation of any of the comprehension expressions, that change shouldn't be visible until after the evaluation of the entire comprehension. See #1571, wherein each instance of the comprehension variables were made indepdendent, as part of this theory. It has also been proposed that comprehensions could actually use multiple threads and be evaluated in parallel. This change would make their semantics more fully concurrent, thereby facilitating the possibility of actually evaluating comprehensions in parallel. Aside from increased concurrency, an immediate and significant benefit of this change would be to drastically improve the type inference of comprehensions in global scope, which has been a very commonly raised issue (see this thread, for example).
The text was updated successfully, but these errors were encountered:
It is interesting to note that we already do a transformation like this for parallel constructs like @spawn and @async. The idea there was that all used variables are captured immediately to be sent somewhere else for evaluation. Then we do it locally too, to give more similar behavior for remote and local spawns.
The proposal is that when you write, in global context, something like this:
This actually means this:
The idea is based on the theory that the evaluations of comprehension expressions are independent and implicitly concurrent. Thus, even if the bindings of the global variables
f
,α
,β
andγ
are changed by the evaluation of any of the comprehension expressions, that change shouldn't be visible until after the evaluation of the entire comprehension. See #1571, wherein each instance of the comprehension variables were made indepdendent, as part of this theory. It has also been proposed that comprehensions could actually use multiple threads and be evaluated in parallel. This change would make their semantics more fully concurrent, thereby facilitating the possibility of actually evaluating comprehensions in parallel. Aside from increased concurrency, an immediate and significant benefit of this change would be to drastically improve the type inference of comprehensions in global scope, which has been a very commonly raised issue (see this thread, for example).The text was updated successfully, but these errors were encountered: