4 ms·
> PHP developers specifically took into consideration RAII when designing the language. No part of that phrase matches reality. > Cycles don't really affect R
by masklinn 12y ago
> PHP developers specifically took into consideration RAII when designing the language.
No part of that phrase matches reality.
> Cycles don't really affect RAII in meaningful way.
Which is irrelevant because once again what PHP has is not RAII it's reference counting, same as CPython and Objective-C. And because it's refcounting it does have an impact: objects involved in or linked from a cycle are not immediately cleaned up once the cycle goes out of scope because all objects still have a refcount of at least 1.
Cycles which, by the way, PHP did not bother breaking until 5.3: http://php.net/manual/en/features.gc.collecting-cycles.php http://php.net/manual/en/features.gc.collecting-cycles.php so these objects would live until process death.
- wvenable 12y ago> No part of that phrase matches reality. It's true. When exception handling was added to PHP, RAII was absolutely factored into the design. This is why it didn't get a finally clause to start with -- it's unnecessary. > Which is irrelevant because once again what PHP has is not RAII it's reference counting http://www.hackcraft.net/raii/ http://www.hackcraft.net/raii/ http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initial... If you have reference counting or stack allocated objects than you can do RAII. You seem to be confused as what these terms mean -- they are not contradictory, they are complimentary. Ref counting allows RAII.