title: Check if a type implements an interface in Julia
body: <p>How to check that a type implements an interface in Julia?</p>
  
  <p>For exemple iteration interface is implemented by the functions <code>start</code>, <code>next</code>, <code>done</code>. </p>
  
  <p>I need is to have a specialization of a function depending on wether the argument type implements a given interface or not.</p>
  
  <p><em>EDIT</em></p>
  
  <p>Here is an example of what I would like to do.</p>
  
  <p>Consider the following code:</p>
  
  <pre><code>a = [7,8,9]
  f = 1.0    
  s = Set()
  push!(s,30)
  push!(s,40)
  
  function getsummary(obj)
    println("Object of type ", typeof(obj))
  end
  
  function getsummary{T&lt;:AbstractArray}(obj::T)
    println("Iterable Object starting with ", next(obj, start(obj))[1])
  end
  
  getsummary(a)
  getsummary(f)
  getsummary(s)
  </code></pre>
  
  <p>The output is:</p>
  
  <pre><code>Iterable Object starting with 7
  Object of type Float64
  Object of type Set{Any}
  </code></pre>
  
  <p>Which is what we would expect since <code>Set</code> is not an <code>AbstractArray</code>. But clearly my second method only requires the type T to implement the iteration interface.</p>
  
  <p>my issue isn't only related to the iteration interface but to all interfaces defined by a set of functions.</p>
  
  <p><em>EDIT-2</em> </p>
  
  <p>I think my question is related to </p>
  
  <p><a href="https://github.com/JuliaLang/julia/issues/5" rel="nofollow">https://github.com/JuliaLang/julia/issues/5</a></p>
  
  <p>Since we could have imagined something like <code>T&lt;:Iterable</code></p>