Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:39726 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95880 invoked from network); 7 Aug 2008 07:13:43 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Aug 2008 07:13:43 -0000 Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 212.25.124.163 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 212.25.124.163 il-gw1.zend.com Windows 2000 SP4, XP SP1 Received: from [212.25.124.163] ([212.25.124.163:8605] helo=il-gw1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 91/8E-29324-4A0AA984 for ; Thu, 07 Aug 2008 03:13:42 -0400 Received: from [10.1.10.20] ([10.1.10.20]) by il-gw1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 7 Aug 2008 10:14:23 +0300 Message-ID: <489AA09C.9090901@zend.com> Date: Thu, 07 Aug 2008 11:13:32 +0400 User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) MIME-Version: 1.0 To: Marcus Boerger CC: Moriyoshi Koizumi , internals@lists.php.net 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> <96829337.20080805132125@marcus-boerger.de> <48983960.3020003@zend.com> <1665638762.20080805213257@marcus-boerger.de> In-Reply-To: <1665638762.20080805213257@marcus-boerger.de> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 07 Aug 2008 07:14:24.0551 (UTC) FILETIME=[389CDB70:01C8F85D] Subject: Re: [PHP-DEV] Inconsistencies in 5.3 From: dmitry@zend.com (Dmitry Stogov) Hi Marcus, In case you really like this syntax, you can try to implement patch and propose it to @internals. I don't like it just because it seems wrong for me, so personally I'll object your patch. Thanks. Dmitry. Marcus Boerger wrote: > Hello Dmitry, > > Tuesday, August 5, 2008, 1:28:32 PM, you wrote: > >> Of course not, but it will be very hard to understand difference and >> fix parser conflicts. > > How is that hard? we have top_statement and inner_statement in our > parser...problem solved. > > Ha, i actually just learned this way that we support inner functions, tsk. > > marcus > >> Thanks. Dmitry. > >> Marcus Boerger wrote: >>> 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 >>> > > > > > Best regards, > Marcus >