groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject New syntax explosion
Date Thu, 05 Oct 2017 18:01:39 GMT
Before Groovy 2.6 and 3.0 are released, will there be a review of the syntax additions for
inclusion in the final release?  I get "!in" and "!instanceof".  However, I'm am getting the
feeling of "Kitchen Sink" or "just because we can" on recent additions to the parser.  I'm
not seeing any of the new syntax adding something I can't get already with reasonably succinct

`foo?['bar']` is just `foo?.getAt('bar')`

`a === b` is just ``

`a ?= b` is just `if (!a) a = b`

`a??.b.c.` is just `a?.b?.c`

'def a = if (x) b else c` is just `def a = x ? b : c`

`def a = switch (x) { case 'b': b; break; case 'c': c; break; }` (or whatever has been proposed)
is just `def a = { switch(x) { ... } )()`

These last two really bother me because statements and expressions have a distinct meaning
in the language and now the meaning is blurred quite completely.  Why is all of this new syntax
necessary?  Isn't it enough to have support for Java array init and lambdas now?

All these new syntax options are making it difficult to entice fellow Java programmers around
the office into using Groovy because it is Java plus a *few* very convenient additons.  I
almost want to be able to turn off some of these additions so the compiler errors on them.

Eric Milles
Lead Software Engineer
Thomson Reuters
Phone: 651-848-7040

View raw message