I'm now watching the talk Engineering Julia for Speed given by Lionel Zoubritzky on JuliaCon 2018. The talked mentioned a function called removetype at about 13:24. I'm wondering how that function could be defined? Thanks.
I'm now watching the talk Engineering Julia for Speed given by Lionel Zoubritzky on JuliaCon 2018. The talked mentioned a function called removetype at about 13:24. I'm wondering how that function could be defined? Thanks.
This is a relatively old video, so I am not sure which Julia version is used there, but currently this function is Base.inferencebarrier (at least as of Julia 1.6 - since it is not exported it is not part of a public API and should not be considered guaranteed to be defined in the future).
Fortunately it is easy enough to define it yourself (I am copy-pasting the current definition):
inferencebarrier(@nospecialize(x)) = Ref{Any}(x)[]
The function makes sure that the compiler is not able to perform type inference of its return type. It is mostly useful if you want to avoid excessive recompilation of your code (the biggest benefit is for cheap higher-order functions).