From 62b45419b71672eabcd63b11004ec08ca373b6c9 Mon Sep 17 00:00:00 2001 From: Paolo Di Tommaso Date: Tue, 3 Nov 2020 11:09:49 +0100 Subject: [PATCH] Add groovy 3 post --- content/blog/2020/groovy3-syntax-sugar.md | 20 +- output/blog.html | 26 ++ output/blog/2020/groovy3-syntax-sugar.html | 321 +++++++++++++++++++++ output/feed.xml | 78 ++++- output/sitemap.xml | 35 +-- output/tags/dsl2.html | 7 +- output/tags/nextflow.html | 7 +- templates/archive.ftl | 2 + 8 files changed, 465 insertions(+), 31 deletions(-) create mode 100644 output/blog/2020/groovy3-syntax-sugar.html diff --git a/content/blog/2020/groovy3-syntax-sugar.md b/content/blog/2020/groovy3-syntax-sugar.md index 094423f0..22976976 100644 --- a/content/blog/2020/groovy3-syntax-sugar.md +++ b/content/blog/2020/groovy3-syntax-sugar.md @@ -1,13 +1,11 @@ - - -# More syntax sugar for Nextflow developers +~~~~~~ The latest Nextflow version 2020.10.0 is the first stable release running on Groovy 3. @@ -18,13 +16,13 @@ Along with this, the new Groovy runtime brings a whole lot of syntax enhancement the everyday life of pipeline developers. Let's see them more in detail. -## Improved not operator +### Improved not operator The `!` (not) operator can now prefix the `in` and `instanceof` keywords. This makes for more concise writing of some conditional expression, for example, the following snippet: ``` -list = [10,20,30] +list = [10,20,30] if( !(x in list) ) { // .. @@ -37,7 +35,7 @@ else if( !(x instanceof String) ) { could be replaced by the following: ``` -list = [10,20,30] +list = [10,20,30] if( x !in list ) { // .. @@ -51,7 +49,7 @@ Again, this is a small syntax change which makes the code a little more readable. -## Elvis assignment operator +### Elvis assignment operator The elvis assignment operator `?=` allows the assignment of a value only if it was not previously assigned (or if it evaluates to `null`). Consider the following example: @@ -77,6 +75,8 @@ if( some_variable != null ) { } ``` +If you are wondering why it's called *Elvis* assigment, well it's simple, because there's also the [Elvis operator](https://groovy-lang.org/operators.html#_elvis_operator) that you should know (and use!) already. 😆 + ### Java style lambda expressions Groovy 3 supports the syntax for Java lambda expression. If you don't know what a Java lambda expression is diff --git a/output/blog.html b/output/blog.html index 9ea6eaec..60ff9084 100644 --- a/output/blog.html +++ b/output/blog.html @@ -107,6 +107,32 @@

Blogging about Nextflow, computational workflows, contain
+
+

More syntax sugar for Nextflow developers!

+ +
    +
  • Paolo Di Tommaso
  • +
  • 03 November 2020
  • + +
+
+

+ +

The latest Nextflow version 2020.10.0 is the first stable release running on Groovy 3.

The first benefit of this change is that now Nextflow can be compiled and run on any modern Java virtual machine, from Java 8, all the way up to the latest Java 15!

Along with this, the new Groovy runtime brings a whole lot of syntax enhancements that can be useful in the everyday life of .. (click here to read more) + +

+ + +

The Nextflow CLI - tricks and treats!