Req #4362 [Opn]: prefixing GLOBALS with _ (naming page vs sample page)
| From: | danielc at analysisandsolutions dot com | Date: | Tue, 17 May 2005 19:32:13 +0000 |
| Subject: | Req #4362 [Opn]: prefixing GLOBALS with _ (naming page vs sample page) | ||
| References: | 1 | Groups: | php.pear.doc |
| Request: | Send a blank email to pear-doc+get-6019@lists.php.net to get a copy of this message | ||
Edit report at http://pear.php.net/bugs/bug.php?id=4362&edit=1
ID: 4362
Updated by: danielc@analysisandsolutions.com
-Summary: http://pear.php.net/manual/en/standards.sample.php
Reported By: pear dot php dot net dot tld at coderoom dot nl
Status: Open
Type: Feature/Change Request
Package: Documentation
Operating System: any
PHP Version: Irrelevant
Assigned To: danielc
New Comment:
Wow. Good catch. I thought you were suggesting the standards be
changed. Now I see there's a conflict between the naming convention
page and the sample file page.
A bigger problem is the packages I've seen (most of which I believe
precede the standards) don't prefix their globals with _, so the
standard doesn't match reality.
On top of all that, I think the naming convention for globals should
match the naming convention for constants, so should not be prefixed
with _. _ in PEAR is meant to prefix private items. Global variables
aren't necessarily private.
Thoughts from others in the community will be appreciated.
Previous Comments:
------------------------------------------------------------------------
[2005-05-17 13:19:04] pear dot php dot net dot tld at coderoom dot nl
Well,
perhaps the documentation is syntactically correct but the naming
convention is imho wrong. The naming convention for global variables in
http://pear.php.net/manual/en/standards.sample.php
contradicts
http://bugs.pear.php.net/manual/en/standards.naming.php
Well, I know it's just a very minor detail, but by using packages it is
really annoying if you can not garantuee which
global/constant/function/class space is used, since not all packages
follow http://bugs.pear.php.net/manual/en/standards.naming.php
or am I
plain wrong and is there a hidden naming convention rule for global
variables?
------------------------------------------------------------------------
[2005-05-17 09:22:40] danielc at analysisandsolutions dot com
The documentation is correct.
------------------------------------------------------------------------
[2005-05-16 20:49:05] pear dot php dot net dot tld at coderoom dot nl
Description:
------------
To understand PEAR's coding standards, especially by learning from
examples, I was wondering if the naming convention of global variables
in this example is intentionally made wrong?
http://pear.php.net/manual/en/standards.sample.php
Expected result:
----------------
$GLOBALS['_NET_SAMPLE_Count'] = 0;
Actual result:
--------------
$GLOBALS['NET_SAMPLE_Count'] = 0;
------------------------------------------------------------------------
--
Edit this bug report at http://pear.php.net/bugs/bug.php?id=4362&edit=1