News for hackers. Stuff that matters.
Re:Critiquing Facebook's new PHP spec by wvenable on Thursday July 31, 2014 @01:57PM (#8115798)
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.

Re:Critiquing Facebook's new PHP spec by arenaninja on Thursday July 31, 2014 @02:08PM (#8115881)
I 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
Re:Critiquing Facebook's new PHP spec by pbiggar on Thursday July 31, 2014 @02:22PM (#8115970)
I 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).

Re:Critiquing Facebook's new PHP spec by wvenable on Thursday July 31, 2014 @02:28PM (#8116013)
It's in direct conflict with the PHP manual:

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.

Re:Critiquing Facebook's new PHP spec by pbiggar on Thursday July 31, 2014 @02:30PM (#8116028)
I 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 :)

Re:Critiquing Facebook's new PHP spec by wvenable on Thursday July 31, 2014 @03:55PM (#8116578)
I 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