On Mon, May 21, 2012 at 1:53 AM, nicolas.o...@gmail.com < nicolas.o...@gmail.com> wrote:
> I just have. This is a nice work. There is a lot of repetitions though. > Thanks Nicolas for putting together these examples. This is exactly what I've been talking about. Whenever someone talks about the issue of developing reusable partial implementation of protocols, the answer is always, "You can do that easily in Clojure by merging mappings." But in practice, I haven't seen many examples of anyone actually doing that. If people who are writing big systems (e.g., Clojurescript) aren't actually providing mergeable mappings, then writing new implementations for these protocols becomes a big copy-paste hackjob. I think part of the problem is that defrecord doesn't directly support using mappings of functions. The construct that supports that is extend, and needs to be done outside of defrecord, possibly costing some efficiency. This encourages people to copy-paste and not write reusable partial implementations. We need to figure out a way to make reusable partial implementations the norm. Maybe the solution is a Clojure construct along the lines of: (get-protocol-implementation <type> <protocol-or-interface>) gives you back a mapping of the functions used by that type to implement that protocol. This would allow you to get at and reuse protocol implementations, even if the original author didn't think to separate out the mapping. Also, a way to use such mappings inside of defrecord would also be a good idea, I think. --Mark -- 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