Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61290 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 77227 invoked from network); 16 Jul 2012 12:46:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Jul 2012 12:46:20 -0000 Authentication-Results: pb1.pair.com header.from=ajfweb@googlemail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ajfweb@googlemail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain googlemail.com designates 74.125.82.54 as permitted sender) X-PHP-List-Original-Sender: ajfweb@googlemail.com X-Host-Fingerprint: 74.125.82.54 mail-wg0-f54.google.com Received: from [74.125.82.54] ([74.125.82.54:63935] helo=mail-wg0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2D/00-11081-A1D04005 for ; Mon, 16 Jul 2012 08:46:19 -0400 Received: by wgx1 with SMTP id 1so1022926wgx.11 for ; Mon, 16 Jul 2012 05:46:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=1S2a5Oz5jyYMGMgqKxFhFLb2hpQ3O5EIbbn2fzYK+zs=; b=UJOXGaMpyWP+rEQx3eKIoOzvpwUUttJ5n+3jd/k+KHpkPv4gJB3qD2RP01sxRTUjbg pLIWMbZPShCd5m4MYtEbD65dxWiZHDTbt8NgsJDgzxyClh/ezlQReuU5TgL8BiI6esEc X77KZUspE/vXEiV7NohRhZiUIVV/xE+gnArjl5SbLm/OGyy76jVnwR7u4WgYwD21lJSl d22ZVirqJNEedioR9TKXeltkPrXIhKU2oTWqnOu/bHF6nn0NNZ4IALqogxawTE2uJywU RO2RMXjq7AqQHLOy6QZDwGGfVTLxRaPoovnTWflqMChd0zZOM8maxq2OJOxXx8dBhOjq CD6w== Received: by 10.216.220.89 with SMTP id n67mr6563045wep.73.1342442776165; Mon, 16 Jul 2012 05:46:16 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.71.199 with HTTP; Mon, 16 Jul 2012 05:45:55 -0700 (PDT) In-Reply-To: References: Date: Mon, 16 Jul 2012 13:45:55 +0100 Message-ID: To: Ferenc Kovacs Cc: PHP Internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] supporting the final keyword for properties From: ajfweb@googlemail.com (Andrew Faulds) C# does this with the readonly keyword, sounds like a good idea. On 16 July 2012 13:25, Ferenc Kovacs wrote: > Hi, > > The recent http://www.mail-archive.com/internals@lists.php.net/msg59301.h= tml > discussion > made me wonder why did we decide not supporting the final keywords for > properties as it would provide an easy way for read-only attributes (cons= t > would be a better choice in performance wise, but then you can only set i= t > in your declaration where no dynamic expression is allowed.) > > I would like it to work the same way as it does in java( > http://docs.oracle.com/javase/specs/jls/se7/html/jls-4.html#jls-4.12.4) e= g. > you can set the initial value either in the declaration or later on, but > after it is set, you can't change it, trying to do that would create a > recoverable fatal error (or throwing an exception which extends > RuntimeException). > > What do you think? Would this be viable? Is there any still-present reaso= n > why we shouldn't support that? > > -- > Ferenc Kov=C3=A1cs > @Tyr43l - http://tyrael.hu --=20 Andrew Faulds (AJF) http://ajf.me/