title: How to share protocols between Clojure & ClojureScript
body: <p>I have a protocol in a crossover namespace:</p>
  
  <pre><code>(ns xxx.shared.interfaces)
  
  (defprotocol ITimer
    (seconds [timer] "Return time in seconds since timer began"))
  </code></pre>
  
  <p>I have an implementation for Clojure:</p>
  
  <pre><code>(ns xxx.time
    (:require [xxx.shared.interfaces :refer [ITimer]]))
  
  (defrecord Timer [start-nanos]
    ITimer
    (seconds [timer] (double (/ (- (System/nanoTime) (:start-nanos timer))
                                1000000000))))
  </code></pre>
  
  <p>The problem is that when I use this code in some Clojure code, having required the <code>xxx.time</code> namespace with <code>:refer :all</code> it complains it can't find <code>seconds</code>:</p>
  
  <pre><code>Unable to resolve symbol: seconds in this context
  </code></pre>
  
  <p>First of all, is it possible to share protocols in this way?</p>
  
  <p>Secondly, any idea how I can make this work?</p>
  
  <p>Thirdly, is this actually a good way to go about this kind of code sharing?  Ideally I'd like to share the record too, but it relies on Java code, so I'd need to break that out into a function.  Would that be a better way to go about this?</p>
  
  <p>Thanks!</p>