Re: [CFV] how to mark protected items?
| From: | Bertrand Mansion | Date: | Tue, 22 Jun 2004 18:35:40 +0000 |
| Subject: | Re: [CFV] how to mark protected items? | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-31096@lists.php.net to get a copy of this message | ||
Tomas V.V.Cox wrote:
>Joshua Eichorn wrote:
>> Tomas V.V.Cox wrote:
>>
>>>
>>> Nope, for PHP4 is clear stated in CS that needs "_"
>>> (http://pear.php.net/manual/en/standards.naming.php). Too much code
>>> wrote this way.
>>>
>>> This discussion should only be for PHP5.
>>>
>> Except thats for private in the standard not protected.
>
>Well, in CS there was no distiction, '_' was for private and protected.
>Was thought for "protecting" the user not the developer :-)
Making a distinction between private, protected and public seems stupid in PHP4.
The idea is more to let the user know that he shouldn't access the instance
variable prefixed with _ directly for reasons like:
- the API might change
- there is an accessor method available
- touch it and you might break the code
(More to be defined if necessary...)
I suggest that if a variable belongs to these, and the code is PHP4, then the
variable be prefixed with _ in order to warn the user.
If the code is PHP5, enforce _ for private only.
Bertrand Mansion
Mamasam