On 12 June 2012 22:00, Jim - FooBar(); <jimpil1...@gmail.com> wrote: > On 12/06/12 19:41, Alan Malloy wrote: >> >> It's not just less convenient, but genuinely incorrect to use dot- >> notation for protocol functions. Not every class that satisfies the >> protocol will be implementing the interface directly, and so dot- >> notation will fail on them. The interface generated by defprotocol >> exists primarily to allow the compiler to optimize certain cases, not >> because it's an interface your application should be using. > > > Hmmm...that sort of makes sense but i wasn't planning on implementing the > protocol outside the current namespace - only consuming its implementors. > Perhaps from a java program - that is why I gave java-like names to my > methods and overrode toString from object on my records. The original > confusion arose from the fact that I wanted to pass IPiece as argument to > avoid reflection which is not needed after all!
If convenience of calling into your code from Java is important, you might want to investigate definterface -- it accepts type hints for parameters and return values (attached to the method name in the latter case) and it actually promises to create an interface. M. -- 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