Is a do-block's anonymous function a closure?


#1

I have this function:

function doJobs(jobsChan, resultsChan)
    Dpl.openLib() do dpl
        while true
            filename = take!(jobsChan)
            filename == END && break
            doJob(filename, resultsChan)
        end
    end
    put!(resultsChan, END)
end

Am I right in assuming that the anonymous function is a closure and that jobsChan and resultsChan are visible inside the while loop (i.e., inside the anonymous function)?


#2

yes.