groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guillaume Laforge <glafo...@gmail.com>
Subject Re: Gramma around annotations
Date Thu, 15 Dec 2016 09:03:00 GMT
Hi Graeme,

Speaking of annotations, in Java 8, there's "repeated annotations" which
hasn't yet been implemented.

Now onto your question...

On Thu, Dec 15, 2016 at 8:52 AM, Graeme Rocher <graeme.rocher@gmail.com>
wrote:

> With all the grammar improvements happening, one that has always
> bothered me is having to do this:
>
> @IgnoreIf( { System.getenv('TRAVIS') } )
> def foo() {}
>
> Instead of
>
> @IgnoreIf { System.getenv('TRAVIS') }
> def foo() {}
>
> Could this be improved with the new grammar? Or are there still
> ambiguity issues?
>

Indeed that would be nicer, but... (although it's not supported today),
we'd like to be able to also annotate closures.
@IgnoreIf( {...} ) is indeed an annotation with a closure parameter, but
@Foo {...}  could be an annotated closure.

What's interesting with allowing annotations pretty much anywhere is that
AST xforms could also be applied anywhere annotations are allowed.
So this would open some interesting perspectives for AST transformations.


-- 
Guillaume Laforge
Apache Groovy committer & PMC Vice-President
Developer Advocate @ Google Cloud Platform

Blog: http://glaforge.appspot.com/
Social: @glaforge <http://twitter.com/glaforge> / Google+
<https://plus.google.com/u/0/114130972232398734985/posts>

Mime
View raw message