-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Open
Labels
macros@macros@macrostypes and dispatchTypes, subtyping and method dispatchTypes, subtyping and method dispatch
Description
A trick currently used in Base (and probably elsewhere) to force specialization on functions is to artificially declare a type parameter, e.g. foo(f::F) where F = f(1). I would bet that the majority of Julia users don't know about this and would look at this piece of code without any idea about the role of F, and would even fix what appears as a naive use of type parameters by simplifying it to foo(f) = f(1).
What about adding some explicit means to this end, for example reusing @specialize: foo(@specialize(f)) = f(1) ?
xref: #33917 (comment)
yurivish, timholy, JeffBezanson, nickrobinson251, jonas-schulze and 7 more
Metadata
Metadata
Assignees
Labels
macros@macros@macrostypes and dispatchTypes, subtyping and method dispatchTypes, subtyping and method dispatch