jastrachan | 4 Mar 08:43 2005

annotations support (was Re: [groovy-user] Groovy beta 10 released! (+JSR Early Access))

Hey Toby

On 3 Mar 2005, at 17:41, Tobias Rademacher wrote:
> Dear groovy team,
> I'm am gadly using groovy in a couple of things (e.g unit testing ant 
> scripts - very cool) and see a high potential in simplying things. 
> Like ruby
> the language already offers combines elegance and efficency in a smart 
> way.
> I am currently a bit out of date. Sorry if my questions are already 
> discussed!
>  Do you plan to support annotations? If you do, it would be fine to 
> use groovy with aspectwerkz (without using the xml workaround) . I can 
> image both tools can lead to maintainable and more robust code.

The JSR parser currently parses annotations; though right now the RI 
just attaches the annotations to the AST and doesn't do any bytecode 
generation from them.

> BTW do you plan any real DCP support beside the very poor "assert" 
> keyword in a future version of groovy?
> Sure you can create pre and postconditions using aspectwerkz+groovy 
> but I guess invariants are harder to to implement?
> What do you think?

Once we've got 1.0 stable and working, one of the things I'd like us to 
investigate is performing DCP stuff using annotations which could 
(rather like decorators in python or lisp macros) generate pre/post 
condition assertions etc. e.g. we could consider attaching 'macros' to 
annotations so that we can modify the AST of groovy as we parser to do 
things like pre/post condition checks, interceptors and so forth.

> The only thing which makes currenlty python/ ruby stornger is a more 
> powerfull  IO api. Unfortuanly the Java2 Platform is missing thinks 
> like getting the size of a disk partitions and so on (I heard this 
> will be increase in future version of java, but we currenlty cannot 
> rely on it :( ). Sure you can use the ant builder to get some features 
> out of the box. Any thoughts about the future enhancments of the 
> groovyDK vs JDK?

We certainly have a bunch of GDK stuff for handling files

int counter = 1
new File("foo.txt").eachLine { line |
     println "${counter++} : $line"

Though we currently don't offer any new features per se - so things 
like disk partition sizing, we'd expect a Java library to do the heavy 
lifting (probably using JNI etc) and then we could just make it a 
little more groovy if required.