Can we have inferable fetch(task)?

Oh right, I see what you had in mind now. I see that you combined return_type with invoke_in_world to get something similar to what world should Tasks run in? · Issue #35690 · JuliaLang/julia · GitHub immediately. Cool!

It looks like the result of return_type is only used as a hint for efficiency and shouldn’t otherwise affect the semantics of the program. So that’s good.

Looking at the implementation of return_type, we can see that it fetches the current (dynamically scoped) world counter using jl_get_tls_world_age:

On the other hand, Base.get_world_counter() fetches the global latest world counter which is not what you want. I think you need to replace get_world_counter with a call to jl_get_tls_world_age.

3 Likes