This post originated from an RSS feed registered with Java Buzz
by dion.
Original Post: Getting excited about Groovy again
Feed Title: techno.blog(Dion)
Feed URL: http://feeds.feedburner.com/dion
Feed Description: blogging about life the universe and everything tech
Although I am using Groovy and enjoying it, I will admit to being a bit worried about it.
It has fantastic potential, but I didn't know if it would have the push to get there. It is always tough if you are developing open source without a company(ies) behind you.
The Groovy London Meetup has just finished (I wish I could have gotten over there), and I am really excited at what I see.
They have ironed out some of the wrinkles in the language, and should be set to use Janino and tools for the parser. Good error messages should be here.
The Java platform is a good one. Where I listen to Miguel talk about Mono and platform vs. language, it reasonates. We can have the same thing with Java. Groovy is just one of these languages, and we have a choice of the tool for the particular solution!
Let's get Groovy and finish it up!
A few langauge changes
// these are all valid
def x = 1
String x = 1
def String x = 1
def x
String x
// however these are invalid declarations of a variable as it could be a typeo
x = 1
x
OR: Maybe the 'any' keyword will be chosen (my preference):
- defining intialized variables/fields:
String foo = "wombat"
Integer i = 45
any bar = "gizmo"
- defining methods:
void someMethod() { ... }
any someOtherMethod() { ... }
String someStringMethod() { ... }
return is not optional UNLESS your block has only one expression
foo() {
println 5
+5 // compile error as this is a dumb expression }
would generate a compile error. It must be one of these instead...
foo() {
println 5+
5
}
foo() {
println 5 +5
}
foo() {
println 5
return +5
}