You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2020/11/11 02:01:04 UTC

[jira] [Closed] (GROOVY-9230) Parentheses: omit or not?

     [ https://issues.apache.org/jira/browse/GROOVY-9230?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul King closed GROOVY-9230.
-----------------------------

> Parentheses: omit or not?
> -------------------------
>
>                 Key: GROOVY-9230
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9230
>             Project: Groovy
>          Issue Type: Documentation
>          Components: syntax
>            Reporter: rkrisztian
>            Priority: Major
>
> The Groovy Style Guide mentions that parentheses can be omitted (not always, I know). And that's it. I think the primary purpose of a style guide is to define a good set of recommendations for coding practices, rather than list all the available options. (Because that's like good old Perl: you can write the same thing in so many ways, since the syntax is so lenient, which then practically doomed the language.) So the style guide that is supposed to give us answers, is still leaving us with questions right now.
> I would like to know what you recommend: should we omit parentheses or not? I am really puzzled, because:
>  * IntelliJ IDEA can suggest auto-removal of unnecessary parentheses.
>  * I think Gradle started with not using parentheses but now it mixes up styles: [https://github.com/gradle/gradle/issues/10307]
>  * The Internet kinda started making up their own style guides, and it is not the first time I see that they actually recommend the parentheses for readability: [https://books.google.hu/books?id=7Hc5DwAAQBAJ&lpg=PA347&ots=I5irALxRRu&dq=groovy%20code%20style%20parentheses&hl=hu&pg=PA347#v=onepage&q=groovy%20code%20style%20parentheses&f=false]
>  * Whereas, for DSLs, the target audience may not know programming so well, so the parentheses are not recommended: [https://books.google.hu/books?id=RNtOCwAAQBAJ&lpg=PA16&ots=xEOKCWi0xo&dq=groovy%20code%20style%20parentheses&hl=hu&pg=PA16#v=onepage&q=groovy%20code%20style%20parentheses&f=false]
> But this still puzzles me.
>  * Are missing parentheses really that hard to read? If someone with no programming skills can read statements without them better, than how come the opposite is true for an advanced programmer?
>  * Should the no-parentheses style be suggested only for DSLs? That would include Gradle too, right?
> Thanks in advance.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)