On Mar 24, 10:19 am, Sean <francoisdev...@gmail.com> wrote: > Some working code would make it a lot easier to understand *exactly* > what you're looking for. Do you think you could post a few quick > methods on github?
No need for gist, this will do as an example: (ns some.namespace (:gen-class :methods [^#{:annotations [SomeAnnotation]} [aMethod [T] S]] ...) This adds an annotation, SomeAnnotation, to the gen-class'd method, aMethod. > If memory serves, the reflections package should > be a good place to start. > > However, you'd need to ask *why* you need this. > > If the answer is "I need to work with and modify a pre-existing, pre- > tested, needs-to-stay-in-production application", then this is a great > idea. Clojrue should help you glue your components together. > > If your answer is "I'm making a brand new application", or "This is > for a side project", this might be a bad approach. Annotations > generally are used to make up for a weakness in the Java language. > Some Clojure language features could probably do the job better > > * Dynamic Typing > * First class functions > * Sequence functions. such as map/reduce/filter etc. > * Macros > > Specifically, I think Guice (and other DI tools) should be avoided. > They are the antithesis of functional programming, and first class > functions will make your life much easier. Try re-thinking about a > problem in a functional style. I'm willing to bet that you'll have a > solution that is easier to write, easier to test, and will scale > better. You're preaching to the choir. The reasoning behind supporting annotations in gen-class is the same as providing gen-class in the first place. Generating classes usable in Java code is sometimes necessary and as gen-class' feature set becomes more complete the better it serves users. > > On Mar 24, 9:57 am, Matt Revelle <mreve...@gmail.com> wrote: > > > Support for using JVM annotations with Clojure code has come up > > several times before, > > I'd like a feature request issue to be created and to start discussing > > the implementation. > > > It seems that an "annotations" metadata tag could contain all > > annotations for an object, > > and any annotations that persist to runtime would need bytecode > > emitted. This appears straightforward, > > but I wonder if there will be a problem using Method or Parameter > > annotations. > > > The motivation for this is to support Java libraries which depend on > > annotations at runtime for discovery and metadata persistence. > > Being able to integrate a class generated by gen-class with, for > > example, a Java project using Guice would be handy. > > > Thoughts? > > > -Matt --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---