a subtle API bug

1 view
Skip to first unread message

William la Forge

unread,
Jul 25, 2015, 2:32:06 PM7/25/15
to AgileWikiDevelopers
Being a newbie to Clojure, I'm likely to get obvious things very wrong. Take for example passing a function to an agent.

the send method passes some function to an agent for evaluation. It is invoked with the first argument being the value of the agent, the remainder being supplied as arguments on the send method. Seemed a bit weird to me, so I ignored this convention. Oops!

Clojure does run-time polymorphism, often using the type of the first argument to determine which function implementation to invoke. This is used especially with records and other types of objects. (Clojure has objects, it just does not like inheritance.) So for example, (close x) would depend on the type of value passed as x to determine how to do the close. --A lot like OO with the implicit this.

So I had to rework the API for agent2. More refactoring->practice makes perfect!


--b
Reply all
Reply to author
Forward
0 new messages