On 8/2/2020 12:20 PM, Eric V. Smith wrote:
On Sat, 1 Aug 2020 at 22:42, Eric V. Smith <eric@trueblade.com <mailto:eric@trueblade.com>> wrote:
While they're immutable at the Python level, strings (and all other objects) are mutated at the C level, due to reference count updates. You need to consider this if you're sharing objects without locking or other synchronization.
This is interesting. What if you want to have a language that uses only immutable objects and garbage collection? Could smart pointers address this problem?
Yes, garbage collection changes the picture entirely, with or without immutable objects. But the original topic was cross-processs shared memory, and I don't know of any cross-process aware garbage collectors that support shared memory. Although such a thing could easily exist without my knowledge.
Note that I'm talking about putting Python objects into this shared memory. If that's not what people are contemplating, then my observations don't apply. Eric