Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61298 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 92449 invoked from network); 16 Jul 2012 13:44:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Jul 2012 13:44:31 -0000 Authentication-Results: pb1.pair.com smtp.mail=ajfweb@googlemail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ajfweb@googlemail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain googlemail.com designates 74.125.82.170 as permitted sender) X-PHP-List-Original-Sender: ajfweb@googlemail.com X-Host-Fingerprint: 74.125.82.170 mail-we0-f170.google.com Received: from [74.125.82.170] ([74.125.82.170:53294] helo=mail-we0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 34/33-11081-DBA14005 for ; Mon, 16 Jul 2012 09:44:30 -0400 Received: by weyr1 with SMTP id r1so4368027wey.29 for ; Mon, 16 Jul 2012 06:44:26 -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; bh=SBI+jeHWW54GZyGRW59869tgKzucONyjr0WWRc+1sBk=; b=ZxrG4jOVs3n1FmM/MswNpkR6TEQVTJs/1ihYAOgzBC+1NP70xP9cFCSM9Fi3Rz361D GR7V7SPR9ynbTIs8yfyUL4/3PzQUSXsUHDU4GquSNxyGTSlpKKxH3ewGxZEC4PrM7Dhl Ap4KJaEUxQ/aVqEBIiiIyRLYcBSk/KHXJgnI3W5tpYeq0MxQba5No7CC+1XJCTpy/2fM uKHR0Un0BTiPhXB9MQfYcl5fAs86Cd+wnMvwwTQaiIMJC6Sj00jxdLKSv0KW3il1yubT 4fy11HJ3ii1YfrbUQrT3kKJETorPa5baG4XNYa564V1YosPGLLjCTcQKaSeoobYDyDbD X+jw== Received: by 10.216.240.196 with SMTP id e46mr4240950wer.224.1342446266454; Mon, 16 Jul 2012 06:44:26 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.71.199 with HTTP; Mon, 16 Jul 2012 06:44:06 -0700 (PDT) In-Reply-To: References: Date: Mon, 16 Jul 2012 14:44:06 +0100 Message-ID: To: Nikita Popov Cc: Ferenc Kovacs , PHP Internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] supporting the final keyword for properties From: ajfweb@googlemail.com (Andrew Faulds) In that case, we should use what C# calls it, "readonly". Writable only once by the constructor. On 16 July 2012 14:35, Nikita Popov wrote: > On Mon, Jul 16, 2012 at 2:25 PM, Ferenc Kovacs wrote: >> Hi, >> >> The recent http://www.mail-archive.com/internals@lists.php.net/msg59301.html >> 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 (const >> would be a better choice in performance wise, but then you can only set it >> 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) eg. >> 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 reason >> why we shouldn't support that? > > I don't like this overloaded meaning of "final". "final" currently > means "cannot be overwritten by inheritance". This would add a second > meaning which would be somewhat similar to "const" (but only > somewhat). > > Nikita > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > -- Andrew Faulds (AJF) http://ajf.me/