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
According to the documentation it can happen, that julia does not specialize functions on Types (and same goes for Functions and Vararg, but I am focussing on Types here).
I think I found a case where Julia should naturally specialize, but does not do so: Creating closures with the type.
Here is an example of what I mean
myconvert(T, value) =T(value)
functionouterfunc(type, value)
innerfunc(x) =myconvert(type, x)
innerfunc(value)
end
using Test
tostring(a) ="$a"@inferredouterfunc(tostring, 1)
# "1"@inferredouterfunc(Symbol, 1)
# ERROR: return type Symbol does not match inferred return type Any
Please correct me if this missing specialization is indeed an intended aspect of julia. It looks accidental to me.
Using Julia 1.7.1
julia> versioninfo()
Julia Version 1.7.1
Commit ac5cc99908 (2021-12-22 19:35 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Core(TM) i7-1065G7 CPU @ 1.30GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-12.0.1 (ORCJIT, icelake-client)
The text was updated successfully, but these errors were encountered:
According to the documentation it can happen, that julia does not specialize functions on Types (and same goes for Functions and Vararg, but I am focussing on Types here).
I think I found a case where Julia should naturally specialize, but does not do so: Creating closures with the type.
Here is an example of what I mean
Please correct me if this missing specialization is indeed an intended aspect of julia. It looks accidental to me.
Using Julia 1.7.1
The text was updated successfully, but these errors were encountered: