Re: [CFV] how to mark protected items?
| From: | Hans Lellelid | Date: | Wed, 16 Jun 2004 14:36:19 +0000 |
| Subject: | Re: [CFV] how to mark protected items? | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-30774@lists.php.net to get a copy of this message | ||
Hi again,
Daniel Convissor wrote:
Wow. This has been a long thread. Unfortunately, it seems no consensus was reached. So, can we please do a simple vote?Does PEAR really need to make a decision about this? These are private and protected members, by definition they are going to be isolated to a particular package. Especially private var naming should be up to the class designer, IMO. There are some basic coding style requirements that make it easy for people to use & debug code, but I'm not entirely sure whether an answer to this question is all that essential. Some people are gonna want '_' because they're used to looking at PHP4 code. '_' is a hack because PHP4 didn't support 'private'. Why that should be required for PHP5 code that does support 'private' makes no sense. (Would '_' exist at all if PHP4 had supported private? I don't think so.) Other people (like myself) think that prefixing nearly every var in a class with an '_' 1) doesn't communicat any additional info about that var that was unassumed and 2) looks really ugly. Perhaps in addition to Hungarian notation we could prefix every var with 'var' -- e.g. $this->sVarMyName, $this->oVarBook. Then there wouldn't be any question that those are class variables. :) Anyway, I think either should be allowed at the discression of the person writing the class. If PEAR needs to make any decision it should only be about protected, and in that case the decision should be obvious :) Hans