You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2020/01/27 09:45:00 UTC

[jira] [Updated] (GROOVY-2489) change list to array for getAt/putAt

     [ https://issues.apache.org/jira/browse/GROOVY-2489?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul King updated GROOVY-2489:
------------------------------
    Fix Version/s: 4.x

> change list to array for getAt/putAt
> ------------------------------------
>
>                 Key: GROOVY-2489
>                 URL: https://issues.apache.org/jira/browse/GROOVY-2489
>             Project: Groovy
>          Issue Type: Sub-task
>          Components: groovy-runtime
>            Reporter: Jochen Theodorou
>            Priority: Major
>             Fix For: 4.x
>
>
> if getAt and putAt are used with multiple arguments, they use a list to store the elements. Not only does his require making a list, it also means, that in MetaClassImpl the one of the slowest paths must be taken to select the method. And even if we cache the method, we always have to unwrap the array. Not to mention, that any possible static type information is lost this way. This implementation is from a time where Groovy was not able to do vargs, but today it is and a vargs based implementation has different advantages. For example no rewrapping is needed, we can use use the arguments for the method call directly. theoretically we could transport static type information this way as well and if the implementing getAt/putAt is using a vargs based parameter it can still get an arbitrary number of arguments. 
> So in the end this change would mean to keep the functionality, but change the rules of the implementation a bit. And because the implementation has to be changed, I consider this a breaking change



--
This message was sent by Atlassian Jira
(v8.3.4#803005)