Skip to content

Instantly share code, notes, and snippets.

@mbauman
Created June 21, 2017 20:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbauman/0ff4719b96334c5237c15ba94df1750b to your computer and use it in GitHub Desktop.
Save mbauman/0ff4719b96334c5237c15ba94df1750b to your computer and use it in GitHub Desktop.
julia> struct SomeType{T}; end
julia> get_parameter{T}(o::SomeType{T}) = T
get_parameter (generic function with 1 method)
julia> f{T}(x::SomeType{T}) = T
f (generic function with 1 method)
julia> g(x::SomeType) = get_parameter(x)
g (generic function with 1 method)
julia> @code_warntype f(SomeType{Int}())
Variables:
#self#::#f
x::SomeType{Int64}
Body:
begin
return $(Expr(:static_parameter, 1))
end::Type{Int64}
julia> @code_warntype g(SomeType{Int}())
Variables:
#self#::#g
x::SomeType{Int64}
Body:
begin
return Int64
end::Type{Int64}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment