3 ms·
I think the language would really need more features, like using blocks from C#, to be effective without RAII. The finally clause was only just added in the la
by wvenable 12y ago
I think the language would really need more features, like using blocks from C#, to be effective without RAII. The finally clause was only just added in the last release.
The spec, as it stands, is flawed. Any removal of RAII should be left to major version (e.g. PHP7). Since this spec is meant to represent the current state of PHP, it's completely incorrect in this area.
- arenaninja 12y agoI think your latter point is part of my confusion. Is this a proposal for what PHP should be or what it currently is? I'm as excited as anyone for the upcoming jPHP but, array bug aside, breaking BC is huge in PHP. I've used the __destruct method plenty of times to automate DB changes without explicitly calling a function to save those changes
- pbiggar 12y agoI disagree. They underspecified the language, so it still technically represents the current state of the Zend implementation of PHP. (I take no position on RAII being useful or not, I don't write PHP for a living).
- wvenable 12y agoIt's in direct conflict with the PHP manual: http://php.net/manual/en/language.oop5.decon.php#language.oop5.decon.destructor http://php.net/manual/en/language.oop5.decon.php#language.oo... "PHP 5 introduces a destructor concept similar to that of other object-oriented languages, such as C++. The destructor method will be called as soon as there are no other references to a particular object, or in any order during the shutdown sequence." It's very common to rely on this behavior to do cleanup as PHP did not have a finally clause (like C++) until recently.
- pbiggar 12y agoI think we're talking at cross-purposes. I'm just saying that because it's underspecified, the Zend engine can be both accurate to what's in the PHP manual, and to what's in the spec. Anyway, it's a slightly pedantic point, so I'm probably not contributing much to the conversation here :)
- wvenable 12y agoI understand your point. The spec as written means the Zend Engine itself is accurate the spec. The problem is the spec isn't accurate to the language, as it exists, in the wild. Existing correct and valid PHP code executed to this spec will behave incorrectly. Therefore, it's not really a PHP spec. PHP Code > PHP Spec > PHP Engine