On Mon, May 21, 2012 at 11:11 AM, nicolas.o...@gmail.com <
nicolas.o...@gmail.com> wrote:

> >
> > And now any of those implementations can easily change at anytime without
> > any external considerations. So what's the problem?
>
> Well if you want to amend all of them at the same time, you have to
> modify all of them.
>

As they are trivially the same, search+replace works really well in my
experience.


> On your advice of using extend-type: maybe I am wrong but I think it
> has a performance cost.
>

An extra function dispatch or two? Not something I would lose sleep over
for anything non-trivial.


> I am not sure for the 1%, but the good metric is to look at the
> percentage of deftypes, not the whole code base.
> I think in a typical program, deftype already amount at less than 10%
> of the code.
>

Sure which just drives my point home even more.


> I wrote some code with a lot of different types implementing the same
> interfaces and that are made
> by composing different parts.
> I ended up splitting aspects in different types and use composition
> and "fake" protocols to implement
> cross-cutting aspects.


Without seeing your code hard to say anything about this.


> I would have loved to have traits to do that
> instead: would have been easier, more performant
> and more natural to read.
>

Again without seeing your approach hard to tack any meaning to "more
performant" or "more natural" to read.

I think ClojureScript is pretty compelling evidence to the soundness of a
protocol oriented inheritance-less approach. We live with a little
redundancy but we achieve a considerable amount of clarity and localized
readability. We've compressed 30,000 (more?) lines of the Java+Clojure
standard library into ~6500 lines of pure Clojure.

David

-- 
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

Reply via email to