It has not been a pain point for me so far, but there is one more thing
that may be somewhat surprising: multimethods and protocols introduce
non-locality into the code.

This means that, with code that uses multimethods or protocols, sometimes
requiring a namespace and not using any symbol from it is not a mistake. It
also means that debugging gets a lot harder.

They are both pretty good to provide extension points, but it is a tradeoff
that is maybe not emphasized enough, as code locality is, for me, the
biggest advantage of functional programming.

This is somewhat akin to use vs require.

On Monday, 27 October 2014, Daniel Higginbotham <nonrecurs...@gmail.com
<javascript:_e(%7B%7D,'cvml','nonrecurs...@gmail.com');>> wrote:

> These responses are all super helpful, thank you! I'd love to hear more
> pitfalls/pain points if anyone else wants to share.
>
> Thanks!
> Daniel
>
> On Monday, October 27, 2014 6:59:43 AM UTC-4, Gary Verhaegen wrote:
>>
>> As recently mentioned on another thread, this also means that you cannot
>> have two different protocols with the same method names in the same
>> namespace. This may be surprising, especially from an OO background, where
>> it is very natural to have two types with the same operations.
>>
>> On Monday, 27 October 2014, Sven Richter <sve...@googlemail.com> wrote:
>>
>>> Hi Daniel,
>>>
>>> When running through tutorials and blog posts it did not occur to me
>>> that the functions of a defprotocol are namespaced to where they are
>>> defined. Meaning, calling these functions I have to use their original
>>> namespace.
>>> It is obvious when one reads the official documentation, but one does
>>> not always do this first, so that wsa one pitfall I ran into.
>>>
>>> Best Regards,
>>> Sven
>>>
>>> Am Sonntag, 26. Oktober 2014 16:48:29 UTC+1 schrieb Daniel Higginbotham:
>>>>
>>>> What's difficult when it comes to understanding multimethods, records,
>>>> types, and protocols? I'm writing a chapter on multimethods, records,
>>>> types, and protocols for the book Clojure for the Brave and True, and I'd
>>>> love to hear about what kinds of pitfalls I should be sure to cover :)
>>>>
>>>> Thanks!
>>>> Daniel
>>>>
>>>  --
>>> 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 unsubscribe from this group and stop receiving emails from it, send
>>> an email to clojure+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>  --
> 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 unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to