Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:48344 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 38863 invoked from network); 19 May 2010 11:04:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 May 2010 11:04:06 -0000 Authentication-Results: pb1.pair.com smtp.mail=fqqdk1@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=fqqdk1@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.161.42 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: fqqdk1@gmail.com X-Host-Fingerprint: 209.85.161.42 mail-fx0-f42.google.com Received: from [209.85.161.42] ([209.85.161.42:64439] helo=mail-fx0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A5/90-34085-4A5C3FB4 for ; Wed, 19 May 2010 07:04:05 -0400 Received: by fxm14 with SMTP id 14so173243fxm.29 for ; Wed, 19 May 2010 04:04:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type; bh=DMDYE5X4jY1yzZ9Y/Qcs+RW2HK/otNS38Ugebc6Mues=; b=TGCkMxG/12/djJZgf+DjROLak+nYUOt5D3dTGSXriQTb4jeRqPYIPuAWGEzPNijexC Jc1TSXa48jeCgDGoclk15Y0TwWiNHba3EqTmo7S4vcs2bRBNjQatgzNWhy5ty1X8yKl6 Apk2sfL2pl0bXQle/+5sUE+D4fOd3FnV3GrnY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=i2q2bvK8PIvu/KW5Z6O+79BKezN0/V1N7MVp2sFWwTi2VNS7HkpS2SNhLOYxaBptXz 0vDJ1hi73wfxuwoum2qGLKoyI9N3/hxmBy4BRWCffYkXu4g/hY/oPQCR9pRG1L85SX2q oMMEQ11s/COGFpdwXae+GkZcnIU2q0mOzZJvc= MIME-Version: 1.0 Received: by 10.102.174.2 with SMTP id w2mr6245439mue.116.1274267039873; Wed, 19 May 2010 04:03:59 -0700 (PDT) Sender: fqqdk1@gmail.com Received: by 10.204.146.129 with HTTP; Wed, 19 May 2010 04:03:59 -0700 (PDT) In-Reply-To: References: <4BF3A72B.8020903@mageekbox.net> <4BF3B4E2.5070209@mageekbox.net> Date: Wed, 19 May 2010 13:03:59 +0200 X-Google-Sender-Auth: 5pJwM8dFoA3lE4iXlZpUO_IrNtU Message-ID: To: Tjerk Anne Meesters Cc: Frederic Hardy , PHP internals Content-Type: multipart/alternative; boundary=0016364d25b142bc6d0486f06a0e Subject: Re: [PHP-DEV] Constant and expression ? From: fqqdk@freemail.hu (fqqdk) --0016364d25b142bc6d0486f06a0e Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 2010/5/19 Tjerk Anne Meesters > On Wed, May 19, 2010 at 5:52 PM, Frederic Hardy > wrote: > > Hello ! > >> > >> AFAIK class constants are optimized for speed and therefore don't > >> support expressions; don't expect this to change any time soon ;-) > >> > >>> Is there any feature request about constant and expression ? > >>> I would like to write something like that : > >>> > >>> >>> > >>> namespace foo\bar\directories { > >>> const tmp =3D __DIR__ . '/tmp'; > >>> } > >>> > >>> ?> > > > > So the best solution is something like > define('foo\bar\directories\tmp', __DIR__ . '/tmp'); ?>... > > It 's strange that "define()" function can do something that the "const= " > > keyword can't do, even if "const" keyword evaluation is done at > compilation > > time and "define()" evaluation is done at runtime. > > That's why there's a cost penalty to using define(). > > I wrote a small article that gives an idea of the speed differences: > http://shwup.blogspot.com/2010/04/about-constants.html > > > > > > Best regards, > > Fred. > > > > -- > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > Fr=C3=A9d=C3=A9ric Hardy : Architecte d'application/Admin. syst=C3=A8me= /Ergonome > > Status : En recherche d'emploi > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > > > > > > > -- > -- > Tjerk > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > How about extending the usage of the 'final' keyword to support a java-like syntax? class Foo { private static final $bar =3D 'ex' . 'pression'; // and also private final $baz =3D 'another'.'expression'; // and maybe private final $inTheCtor; public function __construct($aValue) { $this->inTheCtor =3D $value; } } --0016364d25b142bc6d0486f06a0e--