Replies: 1 comment
-
In many places throughout inference, the appearance of unbound (including plain) typevars is a sign that something is going wrong. So maybe a dedicated lattice element might be more appropriate, if just to clearly distinguish intentional vs. unintentional typevars (or their equivalent lattice elements). Another even more radical idea: Could we, upon first inference of a method, synthesize a tfunc for it? That might take a moment, but executing the tfunc should be faster than doing abstract interpretation, so if the method is inferred for many different argument types, it might pay off eventually. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
A potential enhancement to inference would be to make it parametric:
where this should return
T
(the identicalT
I defined with theTypeVar
) instead ofAny
.Let's begin with the downsides:
Any
at the slightest provocation to avoid blowing up inference, meaning that there would be precious few applications of this capability.In the worst-case scenario, this adds up to a massive waste of time.
Now let's consider possible good things that might, if fate smiles on us, come to pass:
getindex(::Vector{T}, Int)
once, and just plug inT
for any concrete case.The last might be a big enough win that this is worth considering. Let me give a (possibly broken) demo implementation, motivated by #49973 (comment):
The caller could prepare this with
Beta Was this translation helpful? Give feedback.
All reactions