Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:39662 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 6001 invoked from network); 5 Aug 2008 11:22:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Aug 2008 11:22:29 -0000 Authentication-Results: pb1.pair.com smtp.mail=helly@php.net; spf=unknown; sender-id=unknown Authentication-Results: pb1.pair.com header.from=helly@php.net; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 85.214.94.56 as permitted sender) X-PHP-List-Original-Sender: helly@php.net X-Host-Fingerprint: 85.214.94.56 aixcept.net Linux 2.6 Received: from [85.214.94.56] ([85.214.94.56:33694] helo=h1149922.serverkompetenz.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4D/9A-45722-4F738984 for ; Tue, 05 Aug 2008 07:22:29 -0400 Received: from MBOERGER-ZRH.corp.google.com (unknown [193.142.125.1]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by h1149922.serverkompetenz.net (Postfix) with ESMTP id 3889611F693; Tue, 5 Aug 2008 13:22:25 +0200 (CEST) Date: Tue, 5 Aug 2008 13:21:25 +0200 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <96829337.20080805132125@marcus-boerger.de> To: Dmitry Stogov CC: Moriyoshi Koizumi , Marcus Boerger , In-Reply-To: <4897F54F.7080909@zend.com> References: <909776579.20080803142659@marcus-boerger.de> <4896A7C4.8090503@zend.com> <4110083360.20080804104233@marcus-boerger.de> <4896EA3C.6010203@zend.com> <4897E9B5.9020006@at.wakwak.com> <4897F54F.7080909@zend.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] Inconsistencies in 5.3 From: helly@php.net (Marcus Boerger) Hello Dmitry, Tuesday, August 5, 2008, 8:38:07 AM, you wrote: > Allowing "use" inside function body assuming allowing it everywhere. > $x = function($arg) { > if ($arg) { > use $a; > } else { > use $b; > } > }; > I don't like such ability and of course we won't be able to use "use" > keyword as it will conflict with import statement. So the import statement use can be placed inside the body of a function as an expression? > Moriyoshi Koizumi wrote: >> Dmitry Stogov wrote: >>> >>> >>> Marcus Boerger wrote: >>>> Hello Dmitry, >>>> >>>> Monday, August 4, 2008, 8:55:00 AM, you wrote: >>>> >>>>> Hi Marcus, >>>> >>>>> see below >>>> >>>>> Marcus Boerger wrote: >>>>>> Hello Internals, >>>>>> >>>>>> please let's not introduce new inconsistencies. Rather lets make new >>>>>> stuff consistent with old stuff during the alpha phase of 5.3. >>>>>> >>>>>> 1) new keyword 'use'. Semantically it is the same as 'static' or >>>>>> 'global' >>>>>> so it should be used in the same location. >>>> >>>>> For me 'use' is the best keyword as it says that closure uses >>>>> variables from current content. (the same keyword is used for import >>>>> from namespaces) >>>> >>>> To be clear, I wasn't complaining about the keyword per se. I just >>>> prefer >>>> it to be inside the curly braces of a closure next to global rather >>>> than in >>>> front of it. >>>> >>> >>> No. The list of lexical variables is a part of the closure definition. >>> >>> The earlier implementation had "lexical" keyword which worked as you >>> are suggesting, but it was much unclear. >> >> I don't think there are many differences in ambiguity between >> >> $closure = function ($arg) { use $a; >> ... >> }; >> >> and >> >> $closure = function ($arg) use ($a) { >> }; >> >> Moriyoshi >> Best regards, Marcus