Annotations

2,473 views
Skip to first unread message

Rich Hickey

unread,
Apr 23, 2010, 8:06:04 PM4/23/10
to Clojure
I've started adding some support for Java annotations, as of this
commit:

http://github.com/richhickey/clojure/commit/fa899d22dceb531d9f5af833ac6af0d956e6bdc7

Example of use:

http://gist.github.com/377213

It supports annotations for definterface/type/record types (put in
metadata on type name), deftype/record fields (in metadata on field
names), and deftype/record methods (in metadata on method name)

Interestingly, the bulk of the work is only 50 lines of Clojure. The
same code should be useful to gen-class.

Feedback welcome,

Rich

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@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+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Laurent PETIT

unread,
Apr 23, 2010, 8:16:10 PM4/23/10
to clo...@googlegroups.com
2010/4/24 Rich Hickey <richh...@gmail.com>:
> I've started adding some support for Java annotations, as of this
> commit:
>
> http://github.com/richhickey/clojure/commit/fa899d22dceb531d9f5af833ac6af0d956e6bdc7
>
> Example of use:
>
> http://gist.github.com/377213
>
> It supports annotations for definterface/type/record types (put in
> metadata on type name), deftype/record fields (in metadata on field
> names), and deftype/record methods (in metadata on method name)
>
> Interestingly, the bulk of the work is only 50 lines of Clojure. The
> same code should be useful to gen-class.
>
> Feedback welcome,

Yay !
Do you also intend to add indentation support for method args ? Seems
to be heavily used e.g. in annotations for web services when one wants
to map methods args names to request args, etc. ?

Richard Newman

unread,
Apr 23, 2010, 9:06:10 PM4/23/10
to clo...@googlegroups.com
> I've started adding some support for Java annotations, as of this
> commit:

Fantastic! I'm just about to do some JAX-WS stuff (which requires
annotations), so this is a welcome change.

The syntax looks no worse than Java's, so no comment on that...

Mark Derricutt

unread,
Apr 24, 2010, 2:01:20 AM4/24/10
to clo...@googlegroups.com
Looks nice from just looking at the gists - I have a small project
where annotations support would actually come in handy as well so will
definitely give this a try shortly.

mark

--
Pull me down under...

On Sat, Apr 24, 2010 at 12:06 PM, Rich Hickey <richh...@gmail.com> wrote:
> It supports annotations for definterface/type/record types (put in
> metadata on type name), deftype/record fields (in metadata on field
> names), and deftype/record methods (in metadata on method name)
>

Daniel Solano Gomez

unread,
Apr 24, 2010, 5:50:45 PM4/24/10
to clo...@googlegroups.com
Thank you very much for this new feature. I was able to use it
successfully to create and test a simple EJB. I wrote about this on my
blog and put a demo up on GitHub.

Blog entry:
http://www.deepbluelambda.org/programming/clojure/building-ejbs-with-clojure
GitHub link:
http://github.com/sattvik/ejb-annot

I have not tried anything in a real application, but it seems to work
quite well.

Thanks again.

Sincerely,

Daniel Solano Gómez

Timothy Pratley

unread,
Apr 29, 2010, 9:04:57 AM4/29/10
to clo...@googlegroups.com
On 24 April 2010 10:06, Rich Hickey <richh...@gmail.com> wrote:
I've started adding some support for Java annotations,
Feedback welcome

Neato! I've been hoping for this - thanks :)
 
Reply all
Reply to author
Forward
0 new messages