Created
June 21, 2017 20:30
-
-
Save mbauman/0ff4719b96334c5237c15ba94df1750b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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