On Wednesday, August 5, 2015 at 4:58:42 AM UTC-7, Georgi Danov wrote:
>
> I wish I could do that in Clojure:
>
> (defn ^:transactional someFunction [...] ...)
>


How about 
https://clojure.github.io/java.jdbc/#clojure.java.jdbc/with-db-transaction? 
These kinds of scope macros are pretty common and have the benefit of being 
very explicit. 

Perhaps, though, it's the ability to late-bind such decorators that you're 
looking for. alter-var-root! is certainly a way to get in to that world. 
lein test does this kind of 
thing: 
https://github.com/technomancy/leiningen/blob/master/src/leiningen/test.clj#L13.
 
I'd be hard-pressed to recommend it though, as I only know about this 
behavior because it bit me recently. 

I would encourage you to consider your specific needs and think about a way 
to address them in a more direct way. Requiring a higher-level construct to 
set up a function before it works, using alter-var-root! or robert-hooke, 
is well into "spooky action at a distance" territory and should be avoided 
if possible. 

- Russell

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to