On Nov 13, 9:13 am, Krukow <karl.kru...@gmail.com> wrote: > I was thinking this may make syntax irregular. I suspect this is a > deliberate design choice to distinguish clojure protocols from java > interfaces? Is this the case? >
As far as I understand it, in defprotocol's case, I suspect there is no dot because the specified operations will be available as normal Clojure functions, whereas in deftype's case you'll need to use Java interop or keywords. For example, after (defprotocol Someproto (foo [x] "do stuff")) you will be able to call (foo something-implementing-someproto), but with deftype, you need to use (.field instance) or, if the type uses the default ILookup implementation, (:field instance). The extend example should just use :seq, as defprotocol will create a function "seq" matching the .seq method in the Seqable interface. (Because no explicit mapping is provided) I hope I got my details right here. I haven't actually tried these things yet. :) -- 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