Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_4_X ed85b205c -> a98293833


GROOVY-7935: fix style guide example for required parentheses


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/a9829383
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/a9829383
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/a9829383

Branch: refs/heads/GROOVY_2_4_X
Commit: a982938330094fab0548ea6e31278a8821a5536d
Parents: 82c9d20
Author: John Wagenleitner <jwagenleit...@apache.org>
Authored: Wed Sep 21 22:20:50 2016 -0700
Committer: John Wagenleitner <jwagenleit...@apache.org>
Committed: Wed Sep 21 22:24:28 2016 -0700

----------------------------------------------------------------------
 src/spec/doc/style-guide.adoc | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/a9829383/src/spec/doc/style-guide.adoc
----------------------------------------------------------------------
diff --git a/src/spec/doc/style-guide.adoc b/src/spec/doc/style-guide.adoc
index 240e047..5458d0d 100644
--- a/src/spec/doc/style-guide.adoc
+++ b/src/spec/doc/style-guide.adoc
@@ -209,16 +209,15 @@ list.each  { println it }
 
 Always prefer the third form, which is more natural, as an empty pair of 
parentheses is just useless syntactical noise!
 
-There are some cases where Groovy doesn't allow you to remove parentheses.
-As I said, top-level expressions can omit them, but for nested method calls or 
on the right-hand side of an assignment,
-you can't omit them there.
+In some cases parentheses are required, such as when making nested method 
calls or when calling a method without parameters.
 
 [source,groovy]
 ----
 def foo(n) { n }
+def bar() { 1 }
 
 println foo 1 // won't work
-def m = foo 1
+def m = bar   // won't work
 ----
 
 == Classes as first-class citizens

Reply via email to