Req #65103 [Opn->Fbk]: consider the final keyword depracation
Edit report at https://bugs.php.net/bug.php?id=65103&edit=1
ID: 65103
Updated by: laruence@php.net
Reported by: knight at kopernet dot org
Summary: consider the final keyword depracation
-Status: Open
+Status: Feedback
Type: Feature/Change Request
Package: Class/Object related
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
I think Final is very useful in the following case:
like I did in Yaf, I got a Yaf class, there are some key resource need to be
initialized. if these resource didn't intialized, then maybe segfault later.
so, I defined a constructor. and do such initialization. but user can extends my
Yaf class, and they also might define there own constructor, and doesn't call the
parent::construct...
so I make the Yaf::construct final.... every is fine now.
Previous Comments:
------------------------------------------------------------------------
[2013-06-23 09:16:07] knight at kopernet dot org
Description:
------------
The final keyword is widely recognized among many programmers that adopted OOP paradigim esp.
comming from or knowing Java.
I find it very problematic though.
Without a real compilation stage using the final keyword in the type hints does not make sure that
all execution paths in the calling code passes an object of the expected type. This is completely
different from Java which actually makes sure the correctness of the passed arguments.
Also when it comes to writing unit tests - there's no way to override a final class and test
code that makes use or depends on such an object.
Please consider deprecating, removing the final keyword or release the imposed restriction.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=65103&edit=1
Thread (4 messages)