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 not in 
function definitions. 
It is just that to me this looks way too invasive to my work habits. Yes, 
it's explicit, but to a java dev an annotation (or meta) is equally 
explicit while being less invasive. 

let me explain:
 - while I am developing I am used to quickly annotate methods so that they 
are instrumented to be traced, performance measured, so on
 - this means I am used to put an annotation, do some work, then comment 
it, and keep it around for when I revisit this code so that I uncomment it. 
If it's tracing with some extra config, this is worth it
 - in the final version, when I am releasing it, many, if not all of these 
annotations are gone
 - often some annotations remain in the code, but the facilities that 
process them are switched off on prod, while I switch them on locally on 
demand.
Guess using @Transactional in my example was not the best choice of 
annotation.

doing that with wrapping forms just feels too heavy. Secondary concern gets 
very prominent place and I don't think that's justified. 

How to mark certain blocks for some instrumenting seems to be matter of 
taste to big extent. However, see how the type hints are implemented as 
meta, and that's right and this is comparable to what I want.

As you properly notice the pre-processing approach might bite sometimes, 
but it's the same when using sprig, so that's something I am used to.

Thanks,
Georgi

On Friday, August 7, 2015 at 12:24:51 PM UTC+2, Shantanu Kumar wrote:
>
> 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 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 
>> accordingly. Let me illustrate it:
>>
>> In Java + Spring
>> @Transactional
>> public void someFunction(){...}
>>
>> the Spring core container has excellent support for preprocessors to 
>> instrument this function with some advice.
>>
>> ---------
>>
>> 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)
>>
>> I have read some blog posts (about dependency injection in the context of 
>> testing clojure) that discuss *alter-var-root,* but that looks like very 
>> brutal approach.
>>
>> What would be the advice on that? I am even happy to go with solution 
>> that involves some micro-container spring-like approach.
>>
>> Cheers
>>
>

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