Skip to content

Instantly share code, notes, and snippets.

@SimonDanisch
Created September 9, 2014 15:34
Show Gist options
  • Save SimonDanisch/2b25c12617855fe58db7 to your computer and use it in GitHub Desktop.
Save SimonDanisch/2b25c12617855fe58db7 to your computer and use it in GitHub Desktop.
function foo(x::Vector{Number}) = println(x)
# Will only be callable with Array{Number},
# but not with any subtype of number like Array{Int}
function foo{T <: Number}(x::Vector{T}) = println(x)
# Will be callable with every Array
function foo{T <: Vector{Z <: FloatingPoint}}(x::Vector{T}) = println(x)
# Doesn't exist :(
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment