Re: "including" Protocols in clojurescript

2012-01-23 Thread Dave Sann
I am still not sure what the definitive answer to this is. Can anyone confirm? 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 -

Re: "including" Protocols in clojurescript

2012-01-19 Thread Meikel Brandmeyer
Thank your for patience with me. :) Now it's clearer. Case 2 and 3 is what I would expect from Clojure and Case 3 is the correct way to solve that problem. Case 1 is surprising (at least for me) and I would consider it “just lucky” as you put it. Adding the explicit require will always work and

Re: "including" Protocols in clojurescript

2012-01-19 Thread Dave Sann
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

Re: "including" Protocols in clojurescript

2012-01-19 Thread Meikel Brandmeyer (kotarak)
I don't think I understand your point. >From your description I take it, that the other.project.proto.correct-user does work for you while other.project.proto.user does not. If this interpretation of mine was correct: This is exactly what you would expect from JVM clojure. Why should it be diff

Re: "including" Protocols in clojurescript

2012-01-19 Thread Dave Sann
I did think the same way as you - but it doesn't seem to be the case. I can think of plausible ways that the compiler might achieve this but I don't know for sure. Anyway, Even with advanced mode compilation it does appear work fine except in the case that I highlighted. I'll leave it to an ex

Re: "including" Protocols in clojurescript

2012-01-19 Thread Meikel Brandmeyer (kotarak)
As an another remark: even if things are baked together into single file (or however cljs works), I would expect the compiler to remove the extend since you did not specify you need it. At least this would be my expectation from the descriptions of the advanced mode of the compiler. Sincerely M

Re: "including" Protocols in clojurescript

2012-01-19 Thread Meikel Brandmeyer (kotarak)
Hi, I still think I'm on the right track with my suspicion when reading your description. Example (Clojure, since I don't know ClojureScript): (ns proto.col) (defprotocol Foo (foo [this that])) (ns proto.participant (:use proto.col)) (extend-protocol Foo MyType (foo [this that] ...))

Re: "including" Protocols in clojurescript

2012-01-19 Thread Dave Sann
Hi, Meikel, this is not the case. Since the file is available to the compiler - it can and generally does do the right thing. David, I think that I have managed to replicate my issue. It occurs in a specific case where the protocols are defined in a jar. j/protocols/fred.cljs - define fred

Re: "including" Protocols in clojurescript

2012-01-18 Thread Meikel Brandmeyer
Hi, Am 18.01.2012 um 22:58 schrieb Dave Sann: > in someother-ns.dom.fred I would expect that you have to explicitly require someother-ns.dom.fred explicitly somewhere. Otherwise the extend does never happen. Sincerely Meikel -- You received this message because you are subscribed to the Goog

Re: "including" Protocols in clojurescript

2012-01-18 Thread Dave Sann
Not in detail. I believe that the code may have been excluded in advanced compilation. I will do some tests and get back to you. D -- 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 th

Re: "including" Protocols in clojurescript

2012-01-18 Thread David Nolen
On Wed, Jan 18, 2012 at 4:58 PM, Dave Sann wrote: > Scenario: > > Define a protocol, generally: > > in some-ns.fred > > (defprotocol Fred > (fred [this] "do something cool and useful")) > > Specifically extend the protocol for dom objects > > in someother-ns.dom.fred > > ; implementing Fred for

"including" Protocols in clojurescript

2012-01-18 Thread Dave Sann
Scenario: Define a protocol, generally: in some-ns.fred (defprotocol Fred (fred [this] "do something cool and useful")) Specifically extend the protocol for dom objects in someother-ns.dom.fred ; implementing Fred for the dom (extend-protocol Fred js/Node (fred [node] (...cool with the