Here is part of the definition of an overloaded protocol:
(defprotocol ClientProtocol
(create-edge
[this outV label inV]
[this outV label inV data])
And here is part of its implementation:
(ns bulbs.neo4jserver.client
(:use [bulbs.base.client :only [ClientProtocol]]))
(deftype Neo4jClient [ns config]
ClientProtocol
(create-edge
[this outV label inV data]
(let [inV-uri (utils/normalize-uri (build-path neo4j-uri vertex-path inV))
path (build-path vertex-path, outV, "relationships")
params {:to inV-uri, :type label, :data (first data)}]
(post config path params)))
(create-edge
[this outV label inV]
;; it doesn't like this call...
(create-edge this outV label inV nil))
It throws this error when the second method tries to call the first:
java.lang.RuntimeException: Unable to resolve symbol: create-edge in this context
I had both definitions working earlier in SLIME when I compiled it with the first function, and then came back and added the second.
But when I moved the protocol definition to a separate file and tried to recompile all of this, it throws an error when the second method tries to call the first, apparently because the first method has not yet been defined.
Clojure docs reifyhave the following comment:
If the method is overloaded in the protocol / interface, several independent method definitions should be provided.
http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/reify
, .
?