After the previous round of discussions here at DPO, we have completely revamped PEP795: Deep Immutability for Efficient Sharing and Concurrency Safety. This rewrite:
- Focuses more on programming model, not just implementation details
- Aims to be clearer about what the costs are for different parts of the design, both in terms of complexity for programmers and implementers of this PEP
- Aims to make the semantics of freezing clearer, and provide more examples of how freezing propagates
- Adds a new design that provides control over freeze propagation
- Adds escape hatches and clearly points out who implements them
- Motivates the design by linking it clearer to sharing objects across sub-interpreters
- Aims to be clearer about the semantics of immutable functions (and why they are unavoidable)
- Discusses the role of types and future plans for types
- Includes direct sharing of immutable objects across sub-interpreters, rather than making a separate PEP for this
- Removes a lot of the rejected alternatives from the original PEP; this is motivated by this PEP already being very long, and because the inclusion of direct sharing across sub-interpreters motivate many of the design decisions
We are very grateful to the many comments and threads on DPO that have contributed to this PEP, and offline discussions with members of the Python community.