Disclaimer: I'm new to Clojure programming.

I work on some Clojure wrapper functions for a Java API that mainly 
consists of interfaces.

I wonder what the 'usual way of doing things' is regarding inheritance 
chains.

Let's say there's an interface called *Element* that has a *getId()*function. A 
second interface, called 
*SubElement,* extends *Element*. I have two clojure namespaces for these 
two interfaces: *foo.element* and *foo.sub-element*. 

In foo.element there is a wrapper for the getId() function:

(defn get-id
  [^Element element]
  (.getId element))

Now my question is regarding foo.sub-element. Should I just redefine get-id 
in there? 

(defn get-id
  [^SubElement element]
  (.getId element))

Or should I do:

(defn get-id
  [^Element element]
  (element/get-id element))

Or should I use potemkin in there?

(potemkin/import-fn element/get-id)

Or should I not re-wrap this function call and work with both namespaces 
when dealing with SubElements? 

What are the pros and cons to these different approaches? Thanks.


-- 
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/d/optout.

Reply via email to