On May 11, 2009, at 15:03, Rich Hickey wrote:

> I have to admit to not having had time to go through your monad code
> in detail, but I'd like to ask the general question:
>
> Why not use dynamic binding in a Clojure implementation of monads?

That is an option I had considered, but quickly abandoned for three  
reasons:

1) Such a choice implies dynamic scoping for monad selection. Dynamic  
scoping for monads doesn't fit well into a language that uses lexical  
scoping for everything else.

2) Dynamic binding doesn't play well with laziness (see my blog post  
at http://onclojure.com/2009/05/06/simulating-dynamic-scoping/ for  
the details).

3) Runtime and perhaps also memory overhead. The use of (binding ...)  
isn't free, and there would be lots of them in a typical monad  
application.

Actually, point 2) is a pretty strong argument against any use of  
dynamic binding in any general-purpose library.

Konrad.


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