On Jun 12, 2012 7:41 PM, "Alan Malloy" <a...@malloys.org> wrote: > > On Jun 12, 5:56 am, "Jim - FooBar();" <jimpil1...@gmail.com> wrote: > > On 12/06/12 13:53, Jim - FooBar(); wrote: > > > > > On 12/06/12 13:47, Meikel Brandmeyer (kotarak) wrote: > > >> If update-position is a protocol function just call it without the > > >> dot. Just like a normal function. Then any reflection will go away > > >> and no type hint is needed. > > > > > WHAT??? Seriously??? I'll try it... > > > > > Jim > > > > OMG! You were right Meikel... I cannot believe this! I don't recall > > reading about this anywhere... > > 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. >
Another reason the interface exists is for interoperability - if you want a java class to participate in the protocol, you do it by implementing the corresponding interface. Phil > -- > 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 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