You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (JIRA)" <ji...@apache.org> on 2019/05/29 23:01:00 UTC

[jira] [Created] (GROOVY-9152) Default Arguments: fix statement about order of required and optional parameters

Eric Milles created GROOVY-9152:
-----------------------------------

             Summary: Default Arguments: fix statement about order of required and optional parameters
                 Key: GROOVY-9152
                 URL: https://issues.apache.org/jira/browse/GROOVY-9152
             Project: Groovy
          Issue Type: Documentation
            Reporter: Eric Milles


[http://docs.groovy-lang.org/latest/html/documentation/#_default_arguments] states:

"Note that no mandatory parameter can be defined after a default parameter is present, only other default parameters."


This is demonstrably false:
{code:groovy}
void blah(String s = 'hello', Object o) { println s }
blah(null) // prints "hello"
{code}


Also, could this section be expanded to include some more examples?  Especially at least one example that uses a back reference to initialize a parameter, like:
{code:groovy}
void blah(Object o, String s = o.toString()) {
  println s
}
{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)