Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:48696 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 15913 invoked from network); 9 Jun 2010 08:51:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Jun 2010 08:51:46 -0000 Authentication-Results: pb1.pair.com smtp.mail=frederic.hardy@mageekbox.net; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=frederic.hardy@mageekbox.net; sender-id=unknown Received-SPF: error (pb1.pair.com: domain mageekbox.net from 212.27.42.6 cause and error) X-PHP-List-Original-Sender: frederic.hardy@mageekbox.net X-Host-Fingerprint: 212.27.42.6 smtp6-g21.free.fr Linux 2.6 Received: from [212.27.42.6] ([212.27.42.6:47888] helo=smtp6-g21.free.fr) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6A/98-52820-0265F0C4 for ; Wed, 09 Jun 2010 04:51:46 -0400 Received: from [192.168.0.10] (tou59-1-82-225-133-227.fbx.proxad.net [82.225.133.227]) by smtp6-g21.free.fr (Postfix) with ESMTP id 665A7E081BB; Wed, 9 Jun 2010 10:51:36 +0200 (CEST) Message-ID: <4C0F5618.6050603@mageekbox.net> Date: Wed, 09 Jun 2010 10:51:36 +0200 User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.9.1.9) Gecko/20100503 Thunderbird/3.0.4 MIME-Version: 1.0 To: =?UTF-8?B?Sm9oYW5uZXMgU2NobMO8dGVy?= CC: fqqdk , Tjerk Anne Meesters , PHP internals References: <4BF3A72B.8020903@mageekbox.net> <4BF3B4E2.5070209@mageekbox.net> <1274272995.14542.10.camel@guybrush> In-Reply-To: <1274272995.14542.10.camel@guybrush> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] Constant and expression ? From: frederic.hardy@mageekbox.net (Frederic Hardy) On 05/19/2010 14:43, Johannes Schlüter wrote: > 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 > So, it's possible ? Very good news. Best regards, Fred. -- ======================================================================== Frédéric Hardy : Architecte d'application/Admin. système/Ergonome ========================================================================