To clarify, I hope:

in: protocols.fred.cljs
...
; define protocol Fred
(defprotocol Fred
  (fred [this] "fred"))

In: dom.protocols.fred.cljs
; extend Fred to js/Node

In: main.cljs
...
(:require [protocols.fred :as f]) ; non specific version
...


(f/fred a-dom-node)

Now - 

Case 1:
put all this in src and compile with cljsc
Works, no problem, any compilation mode.
In the compiled directories: dom.protocols.fred.js is present

my conclusion - because the compiler can see the dom.protocols.fred.cljs - 
it can include and extend without a need for direct reference. (or... just 
lucky)


Case 2:
put dom.protocols.fred.cljs and protocols.fred.cljs in a jar
put the jar in lib
put main in src
compile with cljsc

Fails, protocol not extended to js/Node
In the compiled js directories: dom.protocols.fred.js is not present

Case 3:
as 2, but reference dom.protocols.fred directly in main
(:require [dom.protocols.fred :as _x])

Succeeds.

Conclusion - when it is in a jar (as opposed to the src dir) and is not 
referenced directly,  dom.protocols.fred.cljs is not picked up by the 
compiler.

Questions:
Is this expected behaviour?
Am I doing this correctly? (Quite possibly not.)


I hope this is clearer

Thanks

Dave


-- 
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

Reply via email to