|Groovy 3 Adds Parrot Parser|
|Written by Kay Ewbank|
|Monday, 17 February 2020|
The latest version of Apache Groovy is available with with a brand new parser (code-named Parrot) among other improvements. Groovy is an optionally typed and dynamic language, with static-typing and static compilation capabilities, for the Java platform.
The aim of Groovy is to improve developer productivity because of its concise, familiar and easy to learn syntax. The developers say it integrates smoothly with any Java program, and delivers powerful features including scripting capabilities, Domain-Specific Language authoring, runtime and compile-time meta-programming and functional programming.
Groovy has both a dynamic nature (supporting code styles similar to Ruby and Python) as well as a static nature (supporting styles similar to Java, Kotlin and Scala). The developers of Groovy aim to support and improve both those aspects of the language. In this release Groovy has been improved to better manage null values. You can use Groovy's null-safe navigation operator, piggy back on Java's Optional or provide a null-checking extension to the type checker. These are augmented in Groovy 3 with null-safe indexing for arrays, lists and maps and a new AST transformation @NullCheck for automatically instrumenting code with null checks.
Performance improvements have been gained by the use of more efficient type resolution during compilation.The addition of a Maven Bill Of Materials (BOM) allows more flexible usage of Groovy from other projects.
The new Parrot parser is described as more flexible and maintainable than the parser in previous versions of Groovy. It’s called the Parrot parser because in the early days of creating the parser, the goal was for the new parser’s output to be an exact echo of what the old parser produced. It has since been extended to support additional syntax options and language features.
Other improvements include support for Java’s class do/while loop, as well as support for the more elaborate form of Java’s classic for loop with comma-separate expressions. Support has also been added for Java-style array initialization and for Lambda expressions.
|Last Updated ( Monday, 17 February 2020 )|