Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:67581 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 29797 invoked from network); 28 May 2013 09:27:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 May 2013 09:27:19 -0000 Authentication-Results: pb1.pair.com smtp.mail=krebs.seb@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=krebs.seb@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.51 as permitted sender) X-PHP-List-Original-Sender: krebs.seb@gmail.com X-Host-Fingerprint: 74.125.82.51 mail-wg0-f51.google.com Received: from [74.125.82.51] ([74.125.82.51:36479] helo=mail-wg0-f51.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6E/8D-44058-67874A15 for ; Tue, 28 May 2013 05:27:18 -0400 Received: by mail-wg0-f51.google.com with SMTP id b13so2228797wgh.6 for ; Tue, 28 May 2013 02:27:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=MeIeLxLiiqftMMot5q+LXNUILrJN0nnjGX5Wx/QdQcE=; b=tcPzCDpkBtDR4+cXH936X50D1cxi2BqL95Qbsfuc3lmaubtUSv/AU1qWzy2uW9E1w9 tK3L7TJSBbADvor05JRkg3f6S5QUm4VAKRbGkHU5w+B6LA0RZVVr3ZdV8DW+AN3Y5qNH xkyzUdX2oCSHotIgEWc+numB5iiExwJdscNQqOcm4XWjJYZ4BMLfEUl2Ux+KPJkumGIG X0uKahapQhW9u84bCSPOnKxZFhL3WjW+F+Tl2nEgrAVXTGqMdcALvvMezSPRlWiUEMC7 BUxn1R6h5Ky3yaiiz0kAmdyx3NtyRfw7zorexGVRA/xO5mu/H8UECq/Pm/Puotf1KXNd 2oMg== X-Received: by 10.180.160.167 with SMTP id xl7mr11175111wib.62.1369733235873; Tue, 28 May 2013 02:27:15 -0700 (PDT) MIME-Version: 1.0 Received: by 10.217.116.7 with HTTP; Tue, 28 May 2013 02:26:55 -0700 (PDT) In-Reply-To: References: <06F1F2BA-A054-4B62-AD06-90B621995ADD@strojny.net> <51A474F0.4040408@php.net> Date: Tue, 28 May 2013 11:26:55 +0200 Message-ID: To: Amaury Bouchard Cc: Maciek Sokolewicz , Lars Strojny , Ferenc Kovacs , PHP Internals Content-Type: multipart/alternative; boundary=047d7b624d74f61da604ddc3decc Subject: Re: [PHP-DEV] supporting the final keyword for properties From: krebs.seb@gmail.com (Sebastian Krebs) --047d7b624d74f61da604ddc3decc Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable 2013/5/28 Amaury Bouchard > 2013/5/28 Maciek Sokolewicz > > > It=92s a good idea in general but what about having it for variables as > >> well? Could open interesting possibilities for an optimizer. > >> > >> final $foo =3D "str"; > >> $foo =3D "bar"; // bails out > >> > >> Don't we already have that? It just has a different name: constants. > > > It's different. You can manipulate variables in some ways you can't with > constants. > > This code, for example: > $a =3D 'abc'; > $b =3D 'a'; > print($$b); > > It will display "abc". It's currently not possible to do something simila= r > with constants. > define('FOO', 'bar'); $b =3D 'FOO'; print(constant($b)); and yes, constant() works for namespace- and class-constants too. > > I think the subject was already debated, but I wonder why we should write > that: > final $foo =3D 'bar'; > instead of: > const $foo =3D 'bar'; > --=20 github.com/KingCrunch --047d7b624d74f61da604ddc3decc--