On Sat, Jul 11, 2020 at 8:06 AM Olle Härstedt <olleharst...@gmail.com> wrote: > > Dear internals, > > I'd like to discuss the concept of ownership in PHP, from the point of > view of a new interface UniqueInterface (or SplUniqueInterface or > something), which will throw a UniqueException if refcount > 1. > > Use-case: Mutable objects that cannot be shared (without (deep) cloning).
I don't think you want to do this on refcount, since that would prevent even passing it to another function or using it in any number of expressions. What would make more sense to me would be hooking into copy-on-write, which would also be a slightly less hot code path than reference counting (but still a pretty critical one). It almost sounds like a uniqueness type, something well beyond the capabilities of PHP's type system (and most others). --c -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php