What do we call the type specific versions of methods?

Hey, semantics question. If I write a method with a parametric type, it can (always?) results in distinct llvm code depending on the argument type(s) going in. There is still one method, but two somethings. Do we have a technical term for that something? I didn’t find a clear answer in documentation. Thanks

Eg - julia_f_149 and julia_f_167 have different names and one is appropriately return 1, the other return 2.

julia> function f(v::Val{S}) where S
           if S
               return 1
           else
               return 2
           end
       end

julia> @code_llvm f(Val(true))
;  @ REPL[3]:1 within `f`
; Function Attrs: uwtable
define i64 @julia_f_149() #0 {
top:
;  @ REPL[3]:3 within `f`
  ret i64 1
}

julia> @code_llvm f(Val(false))
;  @ REPL[3]:1 within `f`
; Function Attrs: uwtable
define i64 @julia_f_167() #0 {
top:
;  @ REPL[3]:5 within `f`
  ret i64 2
}

julia> methods(f)
# 1 method for generic function "f":
[1] f(v::Val{S}) where S in Main at REPL[3]:1

These are called method instances (which is the result of a method with given arg types).

6 Likes

cheers