Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:31112 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 17836 invoked by uid 1010); 19 Jul 2007 21:04:30 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 17812 invoked from network); 19 Jul 2007 21:04:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Jul 2007 21:04:30 -0000 Authentication-Results: pb1.pair.com smtp.mail=stas@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=stas@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 63.205.162.114 as permitted sender) X-PHP-List-Original-Sender: stas@zend.com X-Host-Fingerprint: 63.205.162.114 unknown Windows 2000 SP4, XP SP1 Received: from [63.205.162.114] ([63.205.162.114:37200] helo=us-ex1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A6/30-15636-8D1DF964 for ; Thu, 19 Jul 2007 17:04:29 -0400 Received: from [127.0.0.1] ([192.168.16.180]) by us-ex1.zend.com with Microsoft SMTPSVC(6.0.3790.1830); Thu, 19 Jul 2007 14:04:19 -0700 Message-ID: <469FD1CD.8050800@zend.com> Date: Thu, 19 Jul 2007 14:04:13 -0700 Organization: Zend Technologies User-Agent: Thunderbird 2.0.0.4 (Windows/20070604) MIME-Version: 1.0 To: Keryx Web CC: internals@lists.php.net References: <469E5B35.2030602@keryx.se> <469E5E3C.6060807@gmx.li> <469F588B.8010901@keryx.se> In-Reply-To: <469F588B.8010901@keryx.se> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 19 Jul 2007 21:04:19.0833 (UTC) FILETIME=[5FE02690:01C7CA48] Subject: Re: [PHP-DEV] Let blocks From: stas@zend.com (Stanislav Malyshev) > 2. Block scope is part of quite a few languages. Does it serve any purpose in C, C# or Java? Does "my" and "local" serve any purpose in PERL? [1] Funny that you ask, because Perl docs you linked specifically say "local" does not serve any real purpose, is extremely confusing and they have it only for BC reasons. "my" does serve a purpose, but in Perl scopes are a bit different from PHP (anonymous functions, etc.) so per-scope local variables make more sense. > I am not saying that PHP must have it just because it exists in other > languages - far from it! But it can not be *that* hard to imagine use > cases. If it isn't so hard to imagine them, it shouldn't be hard to post them, right? ;) > My main contact with PHP nowadays is teaching it. And my students are > usually newbies to web development. Real namespaces is quite a long way > away from their understanding. Not everyone is a Bill Joy, a Linus > Torvalds or a Rasmus Leerdorf! That's one reason why we work hard to keep the language simple, while on the other hand trying to make it powerful enough to be useful. These are contradicting goals, so finding a balance between them is not easy. That's why new features must be carefully weighted - how much complication does it add? How much power? Is is worth it? Naturally, if one proposes something, it is expected that he'd make the first argument towards proving the worthiness - which may or may not be supported by the community. > Many students - and other newbies - will cut and paste as a part of > their learning process. So even for more simple procedural code there is > a point in being able to hide variables from one snippet to another. function? :) > I consider block scope a sort of "namespaces light", an easy to > understand first step. As JS 2 will have the "let" keyword - and to most > newbies JS will be the principal "other" language besides PHP - a > similar construct would be easy to grasp. I seriously doubt that many newbies need Javascript features that appeared only in 1.7 - such as let blocks with advanced scoping rules - or really understand them. Javascript is rather complicated (and powerful) language - definitely more complicated than PHP, IMHO. -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com