I want to use extend-type to support a protocol both on a class and it's
subclasses. But I don't know how to do a superclass call. So for
instance, with this code....

(defprotocol PThree
  (hello [this]))

(extend-type
    Number PThree
    (hello [this]
      (if (= 10 this)
        "hello")))

(extend-type
    Long PThree
    (hello [this]
      (if (= 5 this)
        "goodbye")))

;; this return "goodbye"
(hello 5)
;; this returns nil
(hello 10)


I really want (hello 10) to return "hello". But the extend-type of Long
takes precedence. How can I call the implementation on the superclass
instead?

Phil

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to