groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paolo Di Tommaso <paolo.ditomm...@gmail.com>
Subject Re: New syntax explosion
Date Thu, 05 Oct 2017 19:47:49 GMT
I tend to agree as well. It should be avoid to overload the language with
cryptic operators only because the new parser allows them, even more when a
not too verbose alternative already exists.

The only that makes sense IMO are:

"!in"
"iinstanceof"
"a ?= b"

For the switch I would wait to have it implement in Java, to avoid to have
to support two eventually different syntaxes.


Best,
Paolo




On Thu, Oct 5, 2017 at 9:35 PM, Keith Suderman <suderman@anc.org> wrote:

> I'm glad I'm not the only.  I've been keeping silent because I'm just a
> stodgy old fart that doesn't like change, but it does seem like there have
> been several syntax changes with little to no discussion, at least here on
> the dev list, and no pressing use cases to justify the changes.  If a
> certain construct is anticipated in Java it makes sense to be forward
> looking and provided something similar, otherwise my concern is that syntax
> will be introduced that will be incompatible with future changes to Java.
>
> Cheers,
> Keith
>
>
> On Oct 5, 2017, at 2:47 PM, Graeme Rocher <graeme.rocher@gmail.com> wrote:
>
> I agree. I'm not keen on if/switch on the right hand side of
> assignments at all and a??.b.c is very obscure
>
> On Thu, Oct 5, 2017 at 8:01 PM,  <eric.milles@thomsonreuters.com> wrote:
>
> 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 code:
>
>
>
> `foo?['bar']` is just `foo?.getAt('bar')`
>
>
>
> `a === b` is just `a.is(b)`
>
>
>
> `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
>
> Email: eric.milles@thomsonreuters.com
>
> Phone: 651-848-7040 <(651)%20848-7040>
>
>
>
>
>
> --
> Graeme Rocher
>
>
> ----------------------
> Keith Suderman
> Research Associate
> Department of Computer Science
> Vassar College, Poughkeepsie NY
> suderman@cs.vassar.edu
>
>
>
>
>

Mime
View raw message