Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61300 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 94724 invoked from network); 16 Jul 2012 13:46:38 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Jul 2012 13:46:38 -0000 Authentication-Results: pb1.pair.com smtp.mail=amaury.bouchard@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=amaury.bouchard@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.42 as permitted sender) X-PHP-List-Original-Sender: amaury.bouchard@gmail.com X-Host-Fingerprint: 209.85.216.42 mail-qa0-f42.google.com Received: from [209.85.216.42] ([209.85.216.42:52933] helo=mail-qa0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B3/B3-11081-C3B14005 for ; Mon, 16 Jul 2012 09:46:37 -0400 Received: by qafi31 with SMTP id i31so1674735qaf.8 for ; Mon, 16 Jul 2012 06:46:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=ZPE5xPkNZQ1Fe4h5lDcOG9HEEgeR5NBafwFwlo0eo68=; b=0+leiqOGgamEeEkkd0W83bz2ja6Za35MmE8LiwZj069/x2Hqxr75Tp+Zi3fx5QbL6E 0MmWIuD/CKAZy0foY7a2qKfNCrbch80XZXRB5NXWq8DjLgYKByzDLxe2bXpdqvJoBr9x 8LZn5RYDj5I5GpI3TaRHGJ9F5Mnn6rBWvhdmpD1ZgQD6vvSjOLwGcaECKq1+L/ipvQcI sLB1BQ3jmJqYSBI8kun5H+hy3Q5Elut0NTIdaIIs0Nfwx2Vg9mW0Unya2iW9nuzafD8C QgK+FCbWXjWAsXYELsnM5LbnnSbP2tO4wprBwuBtCZdfwid8fNjrqBMo2Oew1R2D6ov+ YR0Q== Received: by 10.60.171.174 with SMTP id av14mr15508554oec.61.1342446393385; Mon, 16 Jul 2012 06:46:33 -0700 (PDT) MIME-Version: 1.0 Sender: amaury.bouchard@gmail.com Received: by 10.182.60.131 with HTTP; Mon, 16 Jul 2012 06:46:12 -0700 (PDT) In-Reply-To: References: Date: Mon, 16 Jul 2012 15:46:12 +0200 X-Google-Sender-Auth: 7uu6oTRsGp-4L2_NwLrJhooonEw Message-ID: To: Ferenc Kovacs Cc: PHP Internals Content-Type: multipart/alternative; boundary=bcaec54a325268633004c4f2a89f Subject: Re: [PHP-DEV] supporting the final keyword for properties From: amaury@amaury.net (Amaury Bouchard) --bcaec54a325268633004c4f2a89f Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable It could be useful (given the example of Java usage). But still, if the goal is to have read-only attributes, I think my proposal (separate reading and writing visibilities) is more precise and powerful. 2012/7/16 Ferenc Kovacs > 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 (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) > 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 reaso= n > why we shouldn't support that? > > -- > Ferenc Kov=E1cs > @Tyr43l - http://tyrael.hu > --bcaec54a325268633004c4f2a89f--