(I’m a new user on discuss… consequently I only get two links… sorry, you will have to go search for them!)
Please add a question/answer pair for “How difficult will this be for other implementations (PyPy, CircuitPython, MicroPython, IronPython, Jython)?”
Jython would use the existing and substantial persistent collection work in the JVM space. In particular,
kotlinx.collections.immutable would be a good starting point. Interestingly, it also supports insertion ordering! No need for
frozenmap, we can have
frozendict in Python. Read on if you are interested.
@ilya-g, yes CHAMP can be used to implement hash-sets or hash-maps that preserve element insertion order. I implemented such a data structure last year for another project and now started to back port that data structure to the github repo usethesource/capsule (removed link - jimbaker). You can expect the implementation to appear in the codebase by September .
It was in fact in fact implemented; the implementation for this code, in Kotlin, can be found in the github repo for
The algorithm is documented in papers/presentations that are linked from the github repo usethesource/capsule, especially his PhD thesis. It is possible that this algorithm is too tightly tied to the JVM, eg code generation, but worthwhile to explore further. (I think the codegen is more about layout/access, we do similar things in Jython for Python arrays, but I have not yet read closely this dissertation or the Kotlin code.)
It would be cool if CPython would port code from the JVM space. Return the favor? Regardless, very much doable.