paulk-asert commented on PR #1785:
URL: https://github.com/apache/groovy/pull/1785#issuecomment-1255602797

   We have used code generators (hand-hacked throwaway Groovy scripts) from 
time to time to generate repeated patterns.
   
   We could enhance both the dynamic and static behaviours to do some kind of 
array-level "auto-unboxing" for T[] and the like but we have opted not to in 
the past for better Java integration and (at the time) efficiency with the 
hand-coded primitive variants likely to be more efficient.
   
   We also have `IntArrayIterable` (and Long/Double variants). So we could 
write:
   
   ```
   public static int[] eachWithIndex(int[] self, 
@ClosureParams(value=FromString.class, options="Integer,Integer") Closure 
closure) {
       eachWithIndex(new IntArrayIterable(self), closure);
       return self;
   }
   
   ```
   This saves work when writing the new variants but is probably slightly less 
efficient that the current code in this PR.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to