Details
-
New Feature
-
Status: Closed
-
Major
-
Resolution: Duplicate
-
1.6.2
-
None
-
None
-
None
Description
Currently, there is no way of calling a method with sparse optional parameters that are not sequential with respect to the order in which the parameters are declared.
Python offers this flexibility, and it makes sense that Groovy allow it, too. When implemented, the following would be expected to pass:
public def foo(int a, int b = 42, int c = 314) { return [a, b, c] } // the following two cases pass, atm. assert foo(1) == [1, 42, 314] assert foo(1, 2) == [1, 2, 314] // the following three cases fail, atm. assert foo(1, b: 2) == [1, 2, 314] assert foo(1, c: 3) == [1, 42, 3] assert foo(1, b: 2, c: 3) == [1, 2, 3]
Attachments
Issue Links
- depends upon
-
GROOVY-8451 Non-Map-Based Named Parameter Support
- Open