Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:48343 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 34419 invoked from network); 19 May 2010 10:21:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 May 2010 10:21:31 -0000 Authentication-Results: pb1.pair.com header.from=tjerk.meesters@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=tjerk.meesters@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.83.170 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: tjerk.meesters@gmail.com X-Host-Fingerprint: 74.125.83.170 mail-pv0-f170.google.com Received: from [74.125.83.170] ([74.125.83.170:64588] helo=mail-pv0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 37/00-34085-AABB3FB4 for ; Wed, 19 May 2010 06:21:30 -0400 Received: by pvh1 with SMTP id 1so1383861pvh.29 for ; Wed, 19 May 2010 03:21:27 -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:content-transfer-encoding; bh=RyL0obLeYo5jgiCF8ywwL5iGCHqDBWcvRbk2PpuSJqk=; b=Tec92/Qyex/9GBPGzApERKPRYklyK71He0j7Okstqb61rKI5JKFURRRl0K/30queu6 csStM78JzZ7d9hH10OOWK50tOB4TG+76JVNTrUg6y0hlgViyL98tSPc0tu8g3pUYAUXn 2H2EWNfzw0ftKl7qq587QAd+4BTbp8/zxfLzU= 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 :content-transfer-encoding; b=gVLFxRGGwDNsVvbegWHydwGWxBw/M2LmtPDiy2fV19rAgCPHp/mnefpykDxJEgvORJ TXEeItoQ74919OWBXcFSqdVN3R8vSez0p0cxLYwco5r+vtH4dDk5VERDVkPfYMqeyTec ktmaIyYjabA/JcoqBrfCyyghLXekwDHy7bmXs= MIME-Version: 1.0 Received: by 10.115.98.12 with SMTP id a12mr7229164wam.55.1274264487274; Wed, 19 May 2010 03:21:27 -0700 (PDT) Sender: tjerk.meesters@gmail.com Received: by 10.115.108.18 with HTTP; Wed, 19 May 2010 03:21:27 -0700 (PDT) In-Reply-To: <4BF3B4E2.5070209@mageekbox.net> References: <4BF3A72B.8020903@mageekbox.net> <4BF3B4E2.5070209@mageekbox.net> Date: Wed, 19 May 2010 18:21:27 +0800 X-Google-Sender-Auth: bpgruUANj6np6qtQiUjzqDpkMGg Message-ID: To: Frederic Hardy Cc: PHP internals Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Constant and expression ? From: datibbaw@php.net (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 { >>> =A0 =A0const 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" > =A0keyword can't do, even if "const" keyword evaluation is done at compil= ation > 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=E9d=E9ric Hardy : Architecte d'application/Admin. syst=E8me/Ergonome > =A0 =A0 =A0 =A0Status : 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 > > --=20 -- Tjerk