Re: Re: declaring classes as static or final
| From: | Jason Farrell | Date: | Wed, 29 Sep 2004 11:51:36 +0000 |
| Subject: | Re: Re: declaring classes as static or final | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-13067@lists.php.net to get a copy of this message | ||
Michael Virnstein wrote:
This will explain all the new OOP features in PHP5 Regards, JasonCannot find it in the docs. http://www.php.net/manual/en/language.oop5.final.php doesn't seem to have any comments on that. I'm not at home at the moment, so i couldn't try, but are you really sure that final CLASSES are supported? You're not confusing it with final METHODS, right?2. final classes: final classes can't be extendedalready supportedabstract static methods are already supportednever said php doesn't support it, i just wanted to give some more input on the rules that would fit for my suggestions.same as above5. abstract classes can't be defined finalalready supportedstatic classes would be implementable at the cost of increasing compilertime.To decide whether to think more about it we'd to know a case where youneedsuch syntax, what you win by having it and what you loose if you don'thaveit.A good example for a static class imo, would be e.g. PEAR's DB Class. The DB-Class itself doesn't need to be instantiate, it simply works as factory and has some functions to check stuff. that'd be a class that i would define as "final static class DB {}". The class should not be extended and should not containt non static methods or attributes. Sure it isn't a big deal, if ppl are instantiating the DB Class, but it only has static methods and instantiating it wouldn't make any sense. Regards, Michael Please see: http://www.php.net/zend-engine-2.php