How to avoid full specialization of `haskey(::Dict, key)` on the caller side

I think it’s impossible to do this using ordinary Julia (I suspect that even you break into Julia’s internal, you still can’t do it). The basic idea here is to invoke a specific method instance of haskey (namely haskey(::{Dict{String,T} where T, ::String}) and that specific method instance requires special compilation (to avoid specialization over different input types, otherwise it will still call JIT at runtime).

It’s strange that this feature doesn’t get implemented in Julia, since Julia can already infer type of haskey when input type is abstract. I always thought Julia can do this before, but it seems that this is not the case.

1 Like