Re: Anotating functions for pre-processing

2015-08-10 Thread Georgi Danov
thanks for all the useful replies. I underwent some pc migration so could not answer. to all that suggest that I rethink the use case — I am fully aware of libraries like tools.trace and this approach (with-xyz ...). I am also aware of function composition and I enjoy it in many places, but

Re: Anotating functions for pre-processing

2015-08-07 Thread Shantanu Kumar
Hi Georgi, Have you seen this thread? https://groups.google.com/forum/#!topic/clojure/0hKOFQXAwRc Shantanu On Wednesday, 5 August 2015 17:28:42 UTC+5:30, Georgi Danov wrote: Hi, I have had good 6 months of fun with Clojure and have big appreciation for it's way of doing things. Coming

Anotating functions for pre-processing

2015-08-05 Thread Georgi Danov
Hi, I have had good 6 months of fun with Clojure and have big appreciation for it's way of doing things. Coming from the Java/Spring world however, I still have this nagging desire to be able to annotate functions and have some preprocessor pick up these annotations and decorate the code

Re: Anotating functions for pre-processing

2015-08-05 Thread Stephen C. Gilardi
I wish I could do that in Clojure: (defn ^:transactional someFunction [...] ...) and then have somehow means to decorate someFunction (yes, I am aware there is no container) The code you proposed does have an effect on the someFunction var (but not the function it ends up bound to).

Re: Anotating functions for pre-processing

2015-08-05 Thread Georgi Danov
Thank you Steve with the help of the robect-hooke library I got close: (defn ^:test-meta t [a] (println a)) ;;copy the metadata to the function object (def tt (with-meta t (meta #'t))) (defn adv1 [f a] (println advising f with meta (meta f)) (f a)) (defn adv2 [f a] (println hey! f your

Re: Anotating functions for pre-processing

2015-08-05 Thread Russell Mull
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

Re: Anotating functions for pre-processing

2015-08-05 Thread Timothy Baldridge
I would also recommend reconsidering the premise that this is a feature that is needed. Go back to what your design goals and think about implementing them in a slightly different way. Function composition, for example, can do all sorts of wonderful things. At the risk of sounding rude, I've

Re: Anotating functions for pre-processing

2015-08-05 Thread Stephen Gilardi
I wish I could do that in Clojure: (defn ^:transactional someFunction [...] ...) and then have somehow means to decorate someFunction (yes, I am aware there is no container) The code you proposed does have an effect on the someFunction var (but not the function it ends up bound to).