Re: public/private class methods/variables
| From: | Manuel Lemos | Date: | Thu, 27 Jul 2000 06:51:26 +0000 |
| Subject: | Re: public/private class methods/variables | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-26430@lists.php.net to get a copy of this message | ||
Hello john,
On 26-Jul-00 15:51:08, you wrote:
>I saw a feature request a few days ago (on bugs.php.net) for the
>ability to define public and private class methods and variables. I know
>in our application (www.intacct.com) we would have a real use for such an
>ability.
>I'm willing to take on the task, unless someone else is already working on
>it.
>I'm basically looking for other peoples' opinions .. would such a feature
>be useful in PHP? Are there any reasons not to do it?
I have seen a lot of people requesting that, but honestly it escapes my
understanding the importance of that feature except for the fact that other
(compiled) languages have it and you are used to use it.
The way I see it, member access qualifiers are only useful to prevent
inadverted invalid accesses that are consequences of eventual bugs. This
is all fine for compiled languages because illegal accesses are spoted at
compile time, therefore before you ship your code.
However PHP is an interpreted language. This means that unlike with
compiled languages, the illegal accesses are never be detected before run
your code and you never see them until your code is running a production
site, if ever.
Other than that, I don't know if checking the member accessibility
qualifiers at run time would not impose a execution penalty even when
accessing public members . Zend developers are more qualified to answer
this. Anyway, I supposed not very long time ago somebody was trying to
patch Zend to add these features.
Regards,
Manuel Lemos
Web Programming Components using PHP Classes.
Look at: http://phpclasses.UpperDesign.com/?user=mlemos@acm.org
--
E-mail: mlemos@acm.org
URL: http://www.mlemos.e-na.net/
PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp
--