Navigation

RSS 2.0 New Entries Syndication Feed Atom 0.3 New Entries Syndication Feed

Show blog menu v

 

General

Use it

Documentation

Support

Sibling projects

RIFE powered

Valid XHTML 1.0 Transitional

Valid CSS!

Blogs : Archives

avatar
< TWiki looks at RIFE for inspiration   Continuations != continuations >
Upgraded to Groovy JSR1 in RIFE

RIFE has been supporting Groovy for element implementations, site structure declarations and conditional template blockvalues for almost a year. When Groovy announced that they were going to reimplement the language parser completely and redesign the features of the language itself, I was pretty scared about how the migration to the upcoming version would be.

I finally took the plunge and upgraded to the latest version. To my surprise they were able to make these signification changes to the internals without changing the embedding API. That was already more than I expected! I really didn't have to change anything to RIFE at all! Even more, the bugs that I had reported were all fixed and I didn't have to make an exception for Groovy anymore with regards to the print method.

However, when running the tests I received a number of failures which are due to the minor backwards incompatible changes that the JSR version introduces.

These are the differences that mattered to me:

Heredocs

Instead of using <<<EOS to start a heredoc and EOS to finish it (Perl-style). They now adopted the Python style which I actually prefer much better. Just surround your text with triple quotes: """heredoc""" (example).

No support for splitting a single expression over several lines

We took the habit of using builders and chainable setters in Java, which allows us to write concise and intuitive code like this:

builder 
  .enterElement("groovy/test_groovy2elementinfo1.groovy") 
    .setId("ELEMENT1") 
    .setUrl("/test/element1") 
  .leaveElement(); 

However, the current version of Groovy requires the dot and the method call to be on the same line as the object it's being called upon, so they above code has to become:

element_builder = builder.enterElement("groovy/test_groovy2elementinfo1.groovy")
element_builder.setId("ELEMENT1")
element_builder.setUrl("/test/element1")
element_builder.leaveElement()

I find this a set-back and hope they'll solve this soon (bugreport).

The property keyword has been replaced with an annotation

I'm glad this was done since it's now possible to use the property literal in Groovy builders. Before I has to make an exception for RIFE's site structure and element structure declaration and rename property to prop. In the final 1.0 release, property will be usable in Groovy builders too.

Conclusion

I think that the Groovy team has done a great effort in formalizing the language and still keeping backwards compatibility as good as possible. To everyone who is hesitant to upgrade or start using Groovy, I'd say, don't be! If there's a time to try it out, it's now!

posted by Geert Bevin in RIFE on Apr 11, 2005 2:27 PM : 2 comments [permalink]
 

Comments

Re: Upgraded to Groovy JSR1 in RIFE
According to groovy's bugreport, problem with splitting an expression over several lines has been fixed as of Jul-06-2005:
http://jira.codehaus.org/browse/GROOVY-805
Re: Upgraded to Groovy JSR1 in RIFE
Yeah, I know. I followed its implementation in real time ;)

Add a new comment

:) ;)
=) :-)
:'( :(
:/ :D
:| :p
:o 8)
Your email address will not be displayed at anytime on any page.
Only provide your email address if you'd like updates on this entry
and it's comments by email.
Please answer this simple math question:
11 + 2 = 
 
 
  

Manage subscription

Remove email:
 

< TWiki looks at RIFE for inspiration   Continuations != continuations >
 
 
 
Google
rifers.org web