Better ImmutableList #3816
Conversation
|
There is one stupid error in |
55024a9 to
c08f219
Compare
Drodt
left a comment
There was a problem hiding this comment.
Nice work! Do you have any idea why tests are failing?
Drodt
left a comment
There was a problem hiding this comment.
Nice work! Do you have any idea why tests are failing?
# Conflicts: # key.core/src/main/java/de/uka/ilkd/key/proof/init/InitConfig.java # key.core/src/main/java/de/uka/ilkd/key/taclettranslation/lemma/TacletLoader.java # Conflicts: # key.core/src/main/java/de/uka/ilkd/key/nparser/builder/TacletPBuilder.java # key.core/src/main/java/de/uka/ilkd/key/rule/tacletbuilder/TacletBuilder.java # key.core/src/main/java/de/uka/ilkd/key/rule/tacletbuilder/TacletGenerator.java
|
Thanks for the help. The tests is green now. The null pointer warning will be fixed. |
|
Can we stay with Java's name scheme and call it |
It depends on how you read this. My reading is: The main idea of this PR is to get rid of To tackle this, the PR also contains operational wrappers for |
|
Nice idea! Appears to make a lot of sense indeed! So: Could you or Claude (& you checking) please provide a lot of documentation on the public interface, the static methods and the new classes? Perhaps you can also mention there: Why does ImultabeListList exist? Can the array class not do the same job? |
Issue
We currently have two implementations of immutable sequences with
ImmutableListandImmutableArray. This requires conversions sometimes, but mainly it leads to confusion about which implementation should be taken.Intended Change
This PR unifies everything under
ImmutableList.There are two fresh children classes:
ImmutableListArrayandImmutableListList. Both behave likeImmutableList, but use different data storage (T[]orList<T>) in the background.Some operations from
ImmutableListare quite expensive on this data storages, e.g.,tail()orreverse(). Therefore, I introduced views that emulate these operations, without copying the data, i.e.,ImmutableListConcatasImmutableList#prepend(other)ImmutableListReverseforImmutableList#reverse()ImmutableListSubListforImmutableList#take(n),ImmutableList#skip(n),ImmutableList#tail()These operations are now in$O(1)$ .
The class
ImmutableArrayshould be considered obsolete.Developers should use only the methods and functions of
ImmutableList. Implementation may override them if there is a faster implementation, e.g,tail()onImmutableSList.Plan
ImmutableSListtoImmutableList.Type of pull request
Refactoring (behaviour should not change or only minimally change)
New feature (non-breaking change which adds functionality)
There are changes to the (Java) code
Ensuring quality