Hi, Am 23.11.2009 um 21:46 schrieb Garth Sheldon-Coulson:
bound-fn is very nice, but I've found that capturing *all* dynamic vars is often overkill.
As I said in said thread: I don't think, that this is a big problem. The number Vars having actually a non-root binding should be rather small in the general case. So the saving is not thaaaat large. (For the case file: I asked exactly this in the assembla ticket, but got no answer.)
In fact, I would argue (subject to persuasion otherwise) that capturing all dynamic vars should be the very rare exception rather than the rule. In most cases, it seems to me that a developer should capture just the dynamic vars that he or she has defined in that particular app, allowing other dynamic vars to reset in new threads as they otherwise would. Another library might expect this resetting of its dynamic vars, or the user might expect it of Clojure's default bindings.
Hmm... I see your point, but I'm not sure. I think, the environment should be consisted. If I don't use the other Vars, then there is no problem. If I use them, I'd expect them to not change under the code... Maybe I prefer the current solution.
Analogously there could be a bound-lazy-seq-with (or whatever name) for defining lazy seqs bound over dynamic vars.
bound-seq might be a nice complement to bound-fn. Rich? Sincerely Meikel
smime.p7s
Description: S/MIME cryptographic signature