Thanks for the clarification Stuart! I think I see how to think about
protocols ... and not as an interface, in the java sense. I think it
makes sense to me now.

 Love your book, btw!

-Travis

On Jun 21, 12:31 pm, Stuart Halloway <stuart.hallo...@gmail.com>
wrote:
> Hi Travis,
>
> The choice of "extend" follows from this reasoning:
>
> (1) Create a protocol. At this point there are no implementations. Protocol 
> functions will fail regardless of arguments passed.
>
> (2) Extend the protocol to a String. The protocol has been *extended* to work 
> with one type, Strings.
>
> The word "implements" would imply that something was happening inside 
> *String*, instead of inside the *protocol*. This is both illegal (in Java), 
> and undesirable: in languages where it is legal, "monkey patching" tends to 
> ruin namespaces.
>
> I agree that the terminology is unfamiliar, but it has to be:  the familiar 
> word "implement" suggests exactly the wrong thing.
>
> satisfies? should be used very rarely (people will be tempted to use it write 
> type-tests), so I like the name being distant from extend-protocol, which 
> will be used often.
>
> Stu
>
>
>
> > I notice that there is a "satisfies?" method to determine if something
> > satisfies a protocol. Also, I see that "extend-protocol" doesn't
> > actually let one create a protocol which is an extension of another
> > protocol. Rather, "extend-protocol" really means "implements", in the
> > Java sense.
>
> > When I first learned about this, I found the naming a little confusing
> > and/or misleading. In my humble opinion, based on my experience, I
> > would like to propose renaming "extend-protocol" to "satisfy-
> > protocol", to make the purpose of the "extend-protocol" method clearer
> > and more consistent with the "satisfies?" method.
>
> > Cheers,
> > Travis
>
> > --
> > 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

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