This is an automated email from the ASF dual-hosted git repository. paulk pushed a commit to branch asf-site in repository https://gitbox.apache.org/repos/asf/groovy-website.git
commit b12abb0b598b745aab3d7d4892a9571006f53ecf Author: Paul King <[email protected]> AuthorDate: Tue Sep 29 14:23:26 2020 +1000 prepare for 4.0.0-alpha-1 release (flesh out some of the exploratory areas) --- site/src/site/releasenotes/groovy-4.0.adoc | 82 ++++++++++++++++++++++++++++-- 1 file changed, 78 insertions(+), 4 deletions(-) diff --git a/site/src/site/releasenotes/groovy-4.0.adoc b/site/src/site/releasenotes/groovy-4.0.adoc index 03aaedc..29402b4 100644 --- a/site/src/site/releasenotes/groovy-4.0.adoc +++ b/site/src/site/releasenotes/groovy-4.0.adoc @@ -492,19 +492,93 @@ println "${e - b}ms" -------------------------------------- [[Groovy4.0-ongoing]] -== On-going work still in progress or undergoing investigation +== On-going work === JSR308 improvements (work in progress) Groovy has been improving JSR-308 support over recent versions. In Groovy 4.0, additional support has been added. -=== Java-inspired changes (under investigation) +=== Other areas under investigation -The following changes are being explored as candidate for Groovy 4: +==== .Net-inspired changes (under investigation) + +Can we provide a Groovy equivalent to .Net's Language Integrated Query (LINQ)? +It would support code like below: + +[source,groovy] +-------------------------------------- +from p of persons +leftjoin c of cities +on p.city.name == c.name +select p.name, c.name + +from p of persons +groupby p.gender +having p.gender == 'Male' +select p.gender, max(p.age) + +from p of persons +orderby p.age desc +thenby p.name asc +select p.name +-------------------------------------- + +==== Python-inspired changes (under investigation) + +Can we support additional destructuring options +for e.g. switch statements as per https://www.python.org/dev/peps/pep-0622/[PEP 622 -- Structural Pattern Matching]? + +If supported, then instead of the following existing code: + +[source,groovy] +-------------------------------------- +def make3D(pt) { + switch(pt) { + case Point3D: + return pt + case Point2D: + return new Point3D(pt.x, pt.y, 0) + case List: + def (x, y, z) = pt + if (x == 0 && y == 0 && z == 0) + throw new IllegalArgumentException("Origin not allowed") + return new Point3D(x, y, z) + ... + } +} +-------------------------------------- + +You could use something like: + +[source,groovy] +-------------------------------------- +def make3D(pt) { + switch(pt) { + case Point3D: + return pt + case Point2D(x, y): + return new Point3D(x, y, 0) + case [0, 0, 0]: + throw new IllegalArgumentException("Origin not allowed") + case [x, y, z]: + return new Point3D(x, y, z) + ... + } +} +-------------------------------------- + +==== Java-inspired changes (under investigation) + +The following are being explored as candidate changes for Groovy 4: * Switch expressions -* Module definitions written in Groovy +link:https://openjdk.java.net/jeps/354[JEP 354: Switch Expressions (Second Preview)] +link:https://openjdk.java.net/jeps/361[JEP 361: Switch Expressions] + +* Module definitions written in Groovy (i.e. module-info.groovy) +link:https://issues.apache.org/jira/browse/GROOVY-9273[GROOVY-9273] +* Use of "_" (underscore) for unused parameters (see "Treatment of underscores" in https://openjdk.java.net/jeps/302[JEP 302: Lambda Leftovers]) [[Groovy4.0-breaking]] == Other breaking changes
