Edit report at https://bugs.php.net/bug.php?id=65103&edit=1

 ID:                 65103
 Updated by:         a...@php.net
 Reported by:        knight at kopernet dot org
 Summary:            consider the final keyword depracation
-Status:             Feedback
+Status:             Wont fix
 Type:               Feature/Change Request
 Package:            Class/Object related
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

@knight at kopernet dot org

IMHO that should be either a request to implement something like Reflection 
makeInheritable() . The final keyword has its uses and PHP isn't Java. If 
you're 
really in the mood, please consider writing your thoughts about what should be 
done as improvement at this place, and discussing it on the internals list. 
Such a 
request is rather useless without discussing all possible pro and contra.


Previous Comments:
------------------------------------------------------------------------
[2013-06-25 04:36:35] larue...@php.net

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.

------------------------------------------------------------------------
[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

Reply via email to