Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:42494 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 90460 invoked from network); 5 Jan 2009 17:51:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Jan 2009 17:51:20 -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.116 as permitted sender) X-PHP-List-Original-Sender: stas@zend.com X-Host-Fingerprint: 63.205.162.116 us-gw1.zend.com Windows 2000 SP4, XP SP1 Received: from [63.205.162.116] ([63.205.162.116:5116] helo=us-gw1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3F/91-07052-79842694 for ; Mon, 05 Jan 2009 12:51:19 -0500 Received: from [192.168.16.104] ([192.168.16.104]) by us-gw1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 5 Jan 2009 09:52:01 -0800 Message-ID: <49624894.1090603@zend.com> Date: Mon, 05 Jan 2009 09:51:16 -0800 Organization: Zend Technologies User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) MIME-Version: 1.0 To: Marcus Boerger CC: internals@lists.php.net, Dmitry Stogov , Lukas Kahwe Smith , =?ISO-8859-15?Q?Johannes_Schl=FCter?= References: <272365052.20090104173130@marcus-boerger.de> <496194BC.9040401@zend.com> <832011302.20090105112156@marcus-boerger.de> In-Reply-To: <832011302.20090105112156@marcus-boerger.de> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 05 Jan 2009 17:52:01.0900 (UTC) FILETIME=[50254AC0:01C96F5E] Subject: Re: [PHP-DEV] [RFC] Closures, Lambdas and use From: stas@zend.com (Stanislav Malyshev) Hi! > We have the same with global and static. Can you write them in the middle > of a funciton/method? So asking for what the consequence is, is irrelevant Yes you can. Example: that it would break most PHP applications out there. Next, we chose 'use' > for the keyword, knowing that it was already used elsewhere, dciding that > it is the lesser evil opposed to creating yet another keyword with all > implications of that. So this part is irrelevant to my point as well. You are trying to make it greater evil that it would be otherwise, by making syntax that does different things look exactly the same. > In fact 'use' means create a static variable from the surrounding context, If you ignore the referencing semantics. Which you should not. > And to answer the other question. Obviously 'sttaic' and 'use' are executed > at compile time, so whereever you place them, they are executed before Actually, static is a runtime construct - it generates FETCH_W opcode and ASSIGN_REF opcode. > So here consistency means placing a syntactical element at the same > syntactical location related syntactical elements are placed. The problem is that location is different (you can put static in the middle of the code, and you can't put use there) and semantics is different (static $a is by ref, use $a is not). Only thing similar is that you work with variables in both cases. But if you compare to function parameters, semantic is identical - it happens when entering a function, it is specified at the start, it can be by-val or by ref. The fact that inside engine it is implemented by reusing static's code is not reason enough to expose the user to it. -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com