Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:33198 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 15866 invoked by uid 1010); 17 Nov 2007 04:08:32 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 15851 invoked from network); 17 Nov 2007 04:08:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Nov 2007 04:08:32 -0000 Authentication-Results: pb1.pair.com header.from=sam@sambarrow.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=sam@sambarrow.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain sambarrow.com from 205.234.132.11 cause and error) X-PHP-List-Original-Sender: sam@sambarrow.com X-Host-Fingerprint: 205.234.132.11 scottsdale.servershost.net Received: from [205.234.132.11] ([205.234.132.11:49023] helo=scottsdale.servershost.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 34/1A-51194-0496E374 for ; Fri, 16 Nov 2007 23:08:32 -0500 Received: from [216.15.51.211] (port=50803 helo=[192.168.1.90]) by scottsdale.servershost.net with esmtpsa (SSLv3:RC4-MD5:128) (Exim 4.68) (envelope-from ) id 1ItEyu-0007Ku-1Y; Fri, 16 Nov 2007 22:08:32 -0600 To: Michael McGlothlin Cc: Stanislav Malyshev , internals@lists.php.net In-Reply-To: <473E63A5.7090700@swplumb.com> 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> <473E63A5.7090700@swplumb.com> Content-Type: text/plain Date: Fri, 16 Nov 2007 23:08:32 -0500 Message-ID: <1195272512.12249.15.camel@sams-room> Mime-Version: 1.0 X-Mailer: Evolution 2.10.1 Content-Transfer-Encoding: 7bit X-Antivirus-Scanner: Clean mail though you should still use an Antivirus X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - scottsdale.servershost.net X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - sambarrow.com X-Source: X-Source-Args: X-Source-Dir: Subject: Re: [PHP-DEV] Re: Question about superglobals From: sam@sambarrow.com (Sam Barrow) That's a good point too, usually when globals are used at all they are used in numerous functions It's very rare to see a variable that's used as a global in one or two functions. > 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. On Fri, 2007-11-16 at 20:44 -0700, Michael McGlothlin wrote: > 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.