On Friday, June 29, 2012, Mark Engelberg wrote:

> On Fri, Jun 29, 2012 at 4:50 PM, David Nolen <dnolen.li...@gmail.com>wrote:
>
>> ISeq *is* an interface on Clojure JVM. But ideally it would be
>> protocol as in ClojureScript. But then all ISeq implementing types
>> must also implement this new protocol you are suggesting to get these
>> basic *generic* sequence operations we enjoy today.
>>
>>
> I see, you're not saying it can't be done in Clojure, you're saying it
> wouldn't work on ClojureScript.  It seems to me that's a limitation of
> either ClojureScript, or protocols, or both.  My guess is that it's a
> limitation of ClojureScript, because my understanding is that in Clojure,
> every protocol generates a Java interface, so I can't think of any reason
> why you couldn't list that generated interface as a "type" in another
> protocol (although I haven't tried it).
>

It is a host detail one can take advantage of in Clojure. But it is not a
feature of protocols. In fact using protocols this way will fail. You have
to go under the hood to the generated interface. And even then doesn't work
for extend-typed things.

As far as whether this is a problem for large software I don't share you
concerns. ClojureScript is getting towards 7000 lines of standard library.
Not problems yet. core.logic is approaching 40 protocols and 3000 lines of
code. No problems encountered and none foreseen when the full functionality
is ported to ClojureScript.

Why does this seem to scale? Because Clojure's interfaces were already
written in a protocol style. Inheritance doesn't matter much, and they only
define 2-3 methods on average.

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