Hi, On 4 Nov., 08:50, Paul Hobbs <paul_ho...@hmc.edu> wrote:
> Strong type systems make programming in the large easier. It would be nice > if I didn't have to walk on eggshells when using a library. Written > agreements are also known as "gotchas". I'm not sure what you mean with "strong" type systems. Clojure's type system is dynamic. That means if I call seq on a thing I better make sure that I have an actually seqable thing. Otherwise I get a RuntimeException during runtime of my program. How is that different to a protocol function implementation trying to compare two things? If at least one doesn't implement Comparable you'll get a runtime exception. I take it you expect static typing. That said, I sense a lot of object-oriented thinking in how protocols are seen in the moment. From my point of view, a honest definition of a type or record is: (defrecord Abc [a b c]) (extend-protocol Xyz Abc (x [this] ...) ...) The record has nothing to do with the protocol. The record is a collection of data with a special name representing a value of some special sort. A protocol comprises functions which act on data in a certain abstract way. How this works for different types of data is defined by extending the protocol to the type (and not vice versa; extend-type is a suboptimal way to carry this meaning). That you specify these implementation inline with the type definition is a way to improve performance. But I would even call it pre-mature optimisation in a philosophical way. At the moment I see protocols just as functions acting on data as any other "normal" function does also. But I'm not sure I understand the philosophy of protocols myself. Some the above may be totally off track. YMMV. Sincerely Meikel -- 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