Re: About eliminating ambiguities safe indexing and ternary expression

2020-05-07 Thread Jochen Theodorou

On 08.05.20 04:36, J. David Beutel wrote:
[...]

but how does the .join(','):b() part get parsed into .join([',': b()])?


write it like this:

foo.bar x:y

where x is (','), y is b() and bar is join. And this is equal to (thanks
to optional parentheses):

foo.bar([x:y])

bye Jochen


Re: About eliminating ambiguities safe indexing and ternary expression

2020-05-07 Thread J. David Beutel

On 2020-05-07 13:43 , Daniel.Sun wrote:

```
// https://issues.apache.org/jira/browse/GROOVY-9522
def a() { null }
def b() { '' }
  a()?[b(), a()].join(','):b()  // statement with ambiguities
```
The above statement  with ambiguities can be parsed into:
1) safe indexing expression, `a()?[[b(), a()]].join([',': b()])`
2) ternary expression, `a() ? ([b(), a()].join(',')) : b()`



I'm not familiar with the new syntax, and this may be beside the point, 
but how does the .join(','):b() part get parsed into .join([',': b()])?


Cheers,
11011011


About eliminating ambiguities safe indexing and ternary expression

2020-05-07 Thread Daniel.Sun
Hi all,

Safe indexing has been introduced since Groovy 3.0.0, it is useful but
confuses both parser and users sometimes because it is not a real operator
in order to not breaking existing code as possible as we could. For example,

```
// https://issues.apache.org/jira/browse/GROOVY-9522
def a() { null }
def b() { '' }
 a()?[b(), a()].join(','):b()  // statement with ambiguities 
```
The above statement  with ambiguities can be parsed into:
1) safe indexing expression, `a()?[[b(), a()]].join([',': b()])`
2) ternary expression, `a() ? ([b(), a()].join(',')) : b()`

As safe indexing(i.e. `?[`) has same precedence with safe reference(i.e.
`?.`),  safe indexing has higher precedence than ternary expression. When
ambiguities appear, the expression with ambiguities will be parsed into safe
indexing. As a result, the potential issue is hard for user to find early
and is ususally found when code has been executed...

So I propose to make safe indexing operator `?[` become a real operator,
i.e. it will be defined in the groovy lexer.
* pros: 
1) No ambiguities
2) Better parsing performance
* cons:
1) Breaking some existing ternary expressions without spaces between`?` and
`[`, e.g. `true?[0] : [1]` will be broken, so it has to be rewritten to
`true? [0] : [1]`

As Groovy 3 has been released, I proposed to apply the change to Groovy 4.
Any thoughts?

Cheers,
Daniel Sun



-
Apache Groovy committer & PMC member 
Blog: http://blog.sunlan.me 
Twitter: @daniel_sun 

--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html


[DRAFT] Apache Groovy May 2020 Board Report (reporting on Feb/Mar/Apr)

2020-05-07 Thread Paul King
Hi Everyone,

Any other updates/comments before I submit our latest board report? (Due in
a few days)

Thanks, Paul.

===>8==

## Description:
Apache Groovy is responsible for the evolution and maintenance of the Groovy
programming language. Groovy is a multi-faceted JVM programming language.

## Issues:
No issues requiring board attention at this time.

## Membership Data:
Apache Groovy was founded 2015-11-18 (4 years ago)
There are currently 18 committers and 10 PMC members in this project.
The Committer-to-PMC ratio is 9:5.

Community changes, past quarter:
- No new PMC members. Last addition was Daniel Sun on 2019-05-06.
- No new committers. Last addition was Eric Milles on 2019-08-21.
  A new committer has been invited and has accepted. The iCLA has been
  submitted and we expect it to be processed shortly.

## Project Activity:
A highlight of the last quarter was the GA release of Groovy 3.0.
We continue to work on bug fixes for 2.5 and 3 and continue to assist
other non-Apache projects within the Groovy ecosystem move to 3.0.
We are also working on our roadmap for Groovy 4 and expect to
release an alpha version some time in about the next quarter.

Recent releases:
- 2.5.11 was released on 2020-04-10.
- 3.0.3 was released on 2020-04-10.
- 3.0.2 was released on 2020-03-08.
- 2.5.10 was released on 2020-03-06.
- 2.4.19 was released on 2020-03-03.
- 3.0.1 was released on 2020-02-17.
- 3.0.0 was released on 2020-02-10.
Downloads (Maven central/bintray only):
- For Feb/Mar/Apr quarter: approx 73 million
- last 12 months: ~240M
- since 2012 (when we started keeping stats from above repos):  ~490M

## Community Health:
The community has been having discussions about better ways to promote
Groovy uptake. There remains very strong interest in Groovy but we need to
convert that interest into additional long-term contributors.

Last quarter stats:
- 79/80 PRs opened/closed on GitHub.
- 155/123 issues opened/closed in JIRA.
Master/all branch commits:
- 342/797 commits were contributed from 27/29 contributors
  including 18 non-committer contributors (14 new).