Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:33195 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 10483 invoked by uid 1010); 17 Nov 2007 03:44:42 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 10468 invoked from network); 17 Nov 2007 03:44:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Nov 2007 03:44:41 -0000 Authentication-Results: pb1.pair.com smtp.mail=michaelm@swplumb.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=michaelm@swplumb.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain swplumb.com from 209.181.81.165 cause and error) X-PHP-List-Original-Sender: michaelm@swplumb.com X-Host-Fingerprint: 209.181.81.165 mail.swplumb.com Windows XP Pro SP1, 2000 SP3 Received: from [209.181.81.165] ([209.181.81.165:3184] helo=swplumb.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 07/29-51194-9A36E374 for ; Fri, 16 Nov 2007 22:44:41 -0500 Received: from michael-ms-computer.local [192.168.2.66] by swplumb.com with ESMTP (SMTPD-9.22) id A26203F8; Fri, 16 Nov 2007 20:39:14 -0700 Message-ID: <473E63A5.7090700@swplumb.com> Date: Fri, 16 Nov 2007 20:44:37 -0700 User-Agent: Thunderbird 2.0.0.9 (Macintosh/20071031) MIME-Version: 1.0 To: Stanislav Malyshev CC: Sam Barrow , internals@lists.php.net References: <8D.46.01128.768AD374@pb1.pair.com> <1195246391.21084.15.camel@sbarrow-desktop> <1195250285.4012.6.camel@johannes.nop> <1195251014.21084.20.camel@sbarrow-desktop> <473E349E.3050704@swplumb.com> <473E35A3.3010307@zend.com> <1195259911.10547.9.camel@sams-room> <473E4B39.6040305@zend.com> In-Reply-To: <473E4B39.6040305@zend.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Re: Question about superglobals From: michaelm@swplumb.com (Michael McGlothlin) Stanislav Malyshev wrote: >> Well this is very common with PHP, it's very flexible and it's easy for >> a bad programmer to create chaotic code and get away with it, but this >> can happen with many features of PHP. For serious developers however, > > Right. This is why I don't think it's a good idea to add one more > feature with very high potential for abuse. Code that changes > behaviour of unrelated other code is usually very bad idea - think > about what happens if some of your functions somewhere among 10K lines > of code used $cfg as local variable and then you added $cfg as > superglobal. > >> them. No point in holding stuff back from people who could benefit from >> it just to protect inexperienced them from their own sloppiness. You >> know what I mean? > > Yes, there is a point in not implementing features that would promote > bad coding and unnecessary surprises for the users. Especially when > the same function can be achieved with existing functionality in a > much better way. This assumes there is never a good reason for a super global which makes me wonder why PHP has super globals at all then? What if, because I use it so often and want to differentiate it, it just works better for me to make it a super global? I could always name it with the standard $_ naming scheme so as to not run into accidental use. I don't often use globals but when I do it's usually because it's something I'll use a lot. It doesn't benefit code readability to have the same thing repeated hundreds of times. It's not a big issue but I do like the idea of making super globals easy to do. All this forcefulness of writing pristine code from the people that teach people that it's okay to inline their HTML, Javascript, CSS, SQL, and who knows what else into their PHP? Talk about a recipe for disaster. Oh well, at least you didn't refuse to add a switch statement like Python.