Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:49721 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 34541 invoked from network); 16 Sep 2010 18:35:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Sep 2010 18:35:40 -0000 Authentication-Results: pb1.pair.com smtp.mail=smalyshev@sugarcrm.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=smalyshev@sugarcrm.com; 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:40122] helo=smtp193.dfw.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6D/0B-15036-A73629C4 for ; Thu, 16 Sep 2010 14:35:40 -0400 Received: from relay19.relay.dfw.mlsrvr.com (localhost [127.0.0.1]) by relay19.relay.dfw.mlsrvr.com (SMTP Server) with ESMTP id 9E4EB27496AB; Thu, 16 Sep 2010 14:35:36 -0400 (EDT) Received: by relay19.relay.dfw.mlsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id 4B8EE2748811; Thu, 16 Sep 2010 14:35:36 -0400 (EDT) Message-ID: <4C926377.4050203@sugarcrm.com> Date: Thu, 16 Sep 2010 11:35:35 -0700 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.9) Gecko/20100825 Thunderbird/3.1.3 MIME-Version: 1.0 To: "Ionut G. Stan" CC: "internals@lists.php.net" References: <39505F13-655A-43AF-941E-77750B7F7201@gmail.com> <4C8FC695.2060800@sugarcrm.com> <4C8FD72B.1070108@sugarcrm.com> <4C906333.4030204@sugarcrm.com> <7.0.1.0.2.20100915085504.17eab4d8@zend.com> <12617cf66ae07d7a2fd79a293ed69b85@beberlei.de> <4C9095D5.1050206@toolpark.com> <000001cb5511$467949f0$d36bddd0$@com> <64b4e95cac44ee297a12601d26a5453c@localhost> <4C9258C1.9080207@sugarcrm.com> <4C926083.605@gmail.com> In-Reply-To: <4C926083.605@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Lambdas assigned to constants. Was PHP Annotations RFC + Patch From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! > const foo = function () use ($globalVar) { > > }; How would you call this thing? foo()? Then you have a problem - foo() already has meaning, and it's "call function named foo", not "get constant named foo and call function inside if it's there". Also, it would work different from variables: for variables, these both work: $foo1 = "foo"; $foo1(); $foo1 = function() {}; $foo1(); But for constants the first form wouldn't work - unless you also make foo() mean "check constant foo and if it's a string then call function with the name that equals to its value" - which adds a lot of complexity there. Also note, that const expressions can be used in defaults now (properties, parameters, etc.) - and that means they are cacheable. But Closures aren't cacheable and couldn't be used in defaults - that means you'd be introducing two types of const expressions - the "real const" and the "as if" const. I do not see it working. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227