For everyone else, this is the “question” originally phrased on IRC that lead to my earlier question about “leftover” args. That was the only concrete question I was able to pull out of this.
Edinson, to address the last “question” from this code sample, this was answered earlier in this list, from the question I phrased (search the archives for ‘Assigning "leftover" args to trailing array’ for this thread). In short, what you’re using there is called “multiple assignment”, which doesn’t work the way you’re expecting. You might think it would work similarly to how actual parameters are assigned to varargs formal parameters, but it simply does not. Someone else will have to address the implied questions from the earlier lines in your code sample. From: Edinson E. Padrón Urdaneta [mailto:edinson.padron.urdan...@gmail.com] Sent: Friday, August 14, 2015 10:10 AM To: users@groovy.incubator.apache.org Subject: [Question] Variable Argument Lists, Named Arguments, Optional Parameters and Multiple assignment Greetings, everyone, I have a couple of questions I would like to address with you (if possible) and the best way to explain them (potentially) is through the following lines of code def foo(Map kwargs, Object bar) { /*...*/ } // Instead of this ... def foo(Object bar, Map kwargs) { /*...*/ } // ... wouldn't this be more clear ... def foo(Object bar, Object[] args) { /*...*/ } // ... just like this one? ... def foo(Object bar, Object[] args, Map kwargs) { /*...*/ } // ... and we could combine both this way def foo(Object a=null, Object b) { /*...*/ } // Shouldn't it rise an error? def (int a, int b, int[] rest) = [1, 2, 3, 4] // Given this ... assert a == 1 && b == 2 && rest == [3, 4] // ... why something like this doesn't hold? Gist mirror ~> https://gist.github.com/EPadronU/c1d2455b67b400905530 Thanks in advance for your time