Hi guys,

everyone suggested that I don't need to use '.' when calling methods from a record and in fact doing this gets rid of reflection...However, now that I moved my records in different namespaces than the protocols they satisfy it seems that I can no longer do that! example follows:

(ns place1)

(defprotocol p1
method1
method2
......)

(defprotocol p2
method1
method2
......)

(ns place2)

(defrecord rec1
place1/p1
   method1 [this] (.....)
   method2 [this] (.....)
place1/p2
   method1 [this] (.....)
   method2 [this] (.....)
)


If all of the above are in the same namespace everything works just fine - I don't need (.method1 rec1). If I put them in separate namespaces (as shown above) I cannot do (method1 rec1) and even though it will compile if I do (.method1 rec1) I will get an error at runtime (field cannot be resolved or something)...

any ideas? I'm suspecting I need to :import all records (rec1 rec2 rec3) to place1 but it is not obvious why (at least to me!)...since the protocol is there what is the problem dispatching to the appropriate concrete class? Maybe because the actual concrete classes (records) are in a different package from Java's perspective? But then, if that is true, how can I let the consumer create his own records which satisfy p1 and that can be used inside place1 without touching it...

any pointers are greatly appreciated... :-)

Jim


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