Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:48349 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 57060 invoked from network); 19 May 2010 12:04:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 May 2010 12:04:22 -0000 Authentication-Results: pb1.pair.com header.from=tyra3l@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=tyra3l@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 72.14.220.158 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: tyra3l@gmail.com X-Host-Fingerprint: 72.14.220.158 fg-out-1718.google.com Received: from [72.14.220.158] ([72.14.220.158:52338] helo=fg-out-1718.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1B/74-34085-FB3D3FB4 for ; Wed, 19 May 2010 08:04:16 -0400 Received: by fg-out-1718.google.com with SMTP id 16so4924fgg.11 for ; Wed, 19 May 2010 05:04:13 -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=R3ubc4dJZ5/SmoqGrkpxXsXIF2QwxD9YKTxdtk2Q2pk=; b=YA+IR4vuttraDTOGT6M/vIn3/auiXaKodERZd7Vl7YqQobCg5FNpL9m1K9qlU2HclL Z4zethEzr0GE2V/J7uBMEdcAmCCBYL1VCHoE3pPaLreA7yK7OKUvUvyy0C9T+jWjIqnW +BXS8CAFtslsptVWTG+rHlLClt2Ya2hltspgo= 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=Yqg9B64VMywAupaxl4foURF/VbatSCgsLahJCPuccOR9BE7IB5rV+yWCzsmSf8HRIw ONPuXYkKtxjgDdD1DTA52OAn0zod+Z+t09BPeP2m915BBsiIoehHifgZyTVTW2IYVkUM m1eSTOW/2qfQc6OhXAiqNknDnBIyxavweca7Q= MIME-Version: 1.0 Received: by 10.102.12.26 with SMTP id 26mr6356888mul.35.1274270653048; Wed, 19 May 2010 05:04:13 -0700 (PDT) Sender: tyra3l@gmail.com Received: by 10.204.60.146 with HTTP; Wed, 19 May 2010 05:04:13 -0700 (PDT) In-Reply-To: <4BF3D062.3040205@cschneid.com> References: <4BF3A72B.8020903@mageekbox.net> <4BF3B4E2.5070209@mageekbox.net> <4BF3D062.3040205@cschneid.com> Date: Wed, 19 May 2010 14:04:13 +0200 X-Google-Sender-Auth: Dg7seeIGuV8FCDYJRfreNrYwiSc Message-ID: To: Christian Schneider Cc: fqqdk , PHP internals Content-Type: multipart/alternative; boundary=00163646ba0a9f67190486f14149 Subject: Re: [PHP-DEV] Constant and expression ? From: info@tyrael.hu (Ferenc Kovacs) --00163646ba0a9f67190486f14149 Content-Type: text/plain; charset=UTF-8 On Wed, May 19, 2010 at 1:49 PM, Christian Schneider wrote: > fqqdk wrote: > > How about extending the usage of the 'final' keyword to support a > java-like > > syntax? > > > > class Foo { > > private static final $bar = 'ex' . 'pression'; > > In my book "final" in Java gets an award for sickest abuse of a keyword. > So no, I don't consider this an option. Simply use a class variable (or > define()) if you need to store some runtime calculated value. > > "But can do this" alone is not sufficient as a > reason to bloat PHP IMHO. > > - Chris > I think that is pretty subjective, but I did suprised when I found out, that the global scope constants behaves differently than the class consts. Allowing the class consts to be initialized in runtime(if neccessary) wouldn't breake any php application, only slow them. Can't we do something, to allow broader usage of consts without sacrificing performance? So I propose to add a new syntax: literal. literal should behave how the const behaved, and const should be initialized in runtime. maybe we could check from runtime, that the const was a dynamic value, or literal, and generate a notice for the developer to change the const to literal for gaining performance. What do you think? Tyrael --00163646ba0a9f67190486f14149--