Just curious, what would the behavior of using @inline
be when applied to two functions named the same, but operating differently based on types?
What @inplace
macro are you referring to? Is it in a package? Or do you mean @inline
?
Oops, I mean @inline
. Updated post.
Ok: @inline
will force inlining to occur, whereas otherwise inlining may occur anyway (usually for short functions). The semantics are the same for inlined vs not inlined functions. Roughly: first a method is selected (multiple dispatch), then it is compiled for the specific argument types, and if inlined, the code is directly pasted at the appropriate place inside the other function, otherwise it is called via a jump.
Each gets inlined properly. Try a little demo for yourself and you’ll see. If this didn’t work, multiple dispatch would be incompatible with building efficient code.
The JIT compiler runs only after the input types are known, so there’s no conceptual difficulty in how you go about doing this.