My recent post on how to make memoize more flexible has sparked an interesting discussion about the actual implementation. Christophe Grand and Eugen Dück joined to discuss almost everything Clojure gives you as a tool to handle concurrency. Don't miss the evolution of a quite simple function in a non-concurrent world to a quite complex function in case multiple threads of execution are involved.
As Joshua Bloch says in his talk „API Design and why it matters“:
Write multiple plug-ins before release!
- If you write one, it probably won't support another.
- If you write two, it will support more with difficulty.
- If you write three, it will work fine.
In a recent post of mine on the Clojure group I encountered
exactly this rule. So let's explore it using the example of
clojure.core/memoize
.
Note: You might also be interested in the follow-up.
Clojure provides two basic ways to interface with the host platform.
The more comprehending is gen-class
which I touched in [a previous
post]gc. It's little brother is proxy
. Although less powerful it
is more dynamic than gen-class
. Let's see how it works…
I'm a long-time Clojure user and the developer of several open source projects mostly involving Clojure. I try to actively contribute to the Clojure community.
My most active projects are at the moment VimClojure, Clojuresque and ClojureCheck.
Copyright © 2009-2014 All Right Reserved. Meikel Brandmeyer