Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:71716 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 98542 invoked from network); 29 Jan 2014 08:40:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Jan 2014 08:40:46 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@sugarcrm.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@sugarcrm.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain sugarcrm.com designates 67.192.241.193 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 67.192.241.193 smtp193.dfw.emailsrvr.com Linux 2.6 Received: from [67.192.241.193] ([67.192.241.193:47149] helo=smtp193.dfw.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 41/C0-28363-D8EB8E25 for ; Wed, 29 Jan 2014 03:40:45 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp19.relay.dfw1a.emailsrvr.com (SMTP Server) with ESMTP id C2E703C8E10; Wed, 29 Jan 2014 03:40:42 -0500 (EST) X-Virus-Scanned: OK Received: by smtp19.relay.dfw1a.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id 673CA3C8DE8; Wed, 29 Jan 2014 03:40:42 -0500 (EST) Message-ID: <52E8BE89.3010707@sugarcrm.com> Date: Wed, 29 Jan 2014 00:40:41 -0800 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Andrea Faulds , "internals@lists.php.net" References: <1796143171.126442.1390903281925.open-xchange@app2.ox.registrar-servers.com> In-Reply-To: <1796143171.126442.1390903281925.open-xchange@app2.ox.registrar-servers.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Lexical scoping From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! > Perhaps a future version of PHP (PHP 6? 5.7?) could have lexical scoping with a > "let" keyword? At the very least, it would make foreach() with a reference less > of a problem: > > foreach ($array as let &$a) { > $a = 3; > } > // $a is not in this scope - no need to worry about accidentally changing > last array item Typing unset($a) takes about 3 secs. Since you need to make additions anyway, and you can already easily do it in the language - I don't see any need for introducing new syntax. The use case for it seems pretty small and already served by unset(). -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227