Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:48352 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 77206 invoked from network); 19 May 2010 12:43:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 May 2010 12:43:46 -0000 Authentication-Results: pb1.pair.com header.from=johannes@schlueters.de; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=johannes@schlueters.de; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain schlueters.de from 217.114.211.66 cause and error) X-PHP-List-Original-Sender: johannes@schlueters.de X-Host-Fingerprint: 217.114.211.66 unknown Solaris 10 (beta) Received: from [217.114.211.66] ([217.114.211.66:43328] helo=schlueters.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B5/50-09719-6FCD3FB4 for ; Wed, 19 May 2010 08:43:35 -0400 Received: from localhost (ka.local [127.0.0.1]) by schlueters.de (Postfix) with SMTP id 9C5C4242CD for ; Wed, 19 May 2010 14:43:31 +0200 (CEST) Received: from [192.168.1.33] (ppp-93-104-118-32.dynamic.mnet-online.de [93.104.118.32]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by schlueters.de (Postfix) with ESMTPSA id 3D5F0242CB; Wed, 19 May 2010 14:43:31 +0200 (CEST) To: fqqdk Cc: Tjerk Anne Meesters , Frederic Hardy , PHP internals In-Reply-To: References: <4BF3A72B.8020903@mageekbox.net> <4BF3B4E2.5070209@mageekbox.net> Content-Type: text/plain; charset="UTF-8" Date: Wed, 19 May 2010 14:43:14 +0200 Message-ID: <1274272995.14542.10.camel@guybrush> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Constant and expression ? From: johannes@schlueters.de (Johannes =?ISO-8859-1?Q?Schl=FCter?=) Hi, On Wed, 2010-05-19 at 13:03 +0200, fqqdk wrote: > 2010/5/19 Tjerk Anne Meesters > > I wrote a small article that gives an idea of the speed differences: > > http://shwup.blogspot.com/2010/04/about-constants.html Unfortunately this doesn't tell, what you actually measured. And note that as of 5.3 the "class constant" syntax can be used in the global scope, too. > How about extending the usage of the 'final' keyword to support a java-like > syntax? No. We have a const keyword. Rather somebody interested in this topic might try to come up with a patch to at least allow "constant expressions" this should serve most needs. constant expressions might be stuff like __DIR__.'/foobar.php' or CONST_A | CONST_B. We already have two steps in the constant resolution for constructs like these: php > class A { const C = FOOBAR; } php > define('FOOBAR', 42); php > echo A::C; 42 See zval_update_constant_ex in zend_API.c as a starting point. While such an approach would also require some parser work and some clever idea where/how to store the expression to be evaluated etc. johannes