cgrand/enlive — Issue #30: Templates inherit thread bindings when created
Author: Raynes
Created: 2012-02-13 09:25:34+00:00
State: open

I ran into a bug today where templates created with `deftemplate` seem to behave as if created with `bound-fn`.

Take this example:

```clojure
(def ^{:dynamic true} *foo*)
(defn x [] (prn *foo*))
(binding [*foo* "foo"] (x))
```

This has the effect of printing `"foo"` because when x is called, the `binding` sets the value of `*foo*`. If you replace `x` with a `deftemplate`, `*foo*` is unbound and doesn't get the bindings.

I'm actually pretty shocked that I'm the only one who has noticed this after all this time. This makes Enlive pretty hard to use with Noir and Sandbar because their stateful sessions use bindings to reflect the current session. I'm stuck on moving RefHeap to Enlive because I don't want to delve into the major hax that'd be involved in working around this.

Also, is this project going to be actively maintained in the future? I see there are some pull requests and issues that have been festering for a year or longer. They don't really inspire confidence. :p