Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:89224 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 45026 invoked from network); 16 Nov 2015 09:24:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Nov 2015 09:24:05 -0000 Authentication-Results: pb1.pair.com smtp.mail=mailto.woden@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=mailto.woden@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.178 as permitted sender) X-PHP-List-Original-Sender: mailto.woden@gmail.com X-Host-Fingerprint: 209.85.217.178 mail-lb0-f178.google.com Received: from [209.85.217.178] ([209.85.217.178:33724] helo=mail-lb0-f178.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 92/E2-14654-4B0A9465 for ; Mon, 16 Nov 2015 04:24:05 -0500 Received: by lbbkw15 with SMTP id kw15so84635572lbb.0 for ; Mon, 16 Nov 2015 01:24:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=4NAJBZqOf7M4UROrntQhiDrnU6iS3CLvkpjtDaZtJ4s=; b=kFT1jPkU0ZAeAZgx0Q1G5OUsOIiJbG25SR1GkwgfjOmOIJGJsWns8mu16frhlg1C9J 5bi1/biSxiuCjE46xOWis71UK/abDhN2nSaJISoZj92z8sqjOrKCgY3rKZIGTOekh6iH 6EpUAzGCe0b3Adr1gTyqb2/UmcJF9Y/MBgCGVJwhwNNuA+EqNrzrbL2bfGsobbAiwiEP w5yRoYLXWX8mUhhogVqiHL3Lb5cXbOhTwQNPqTMLYwtFaYCKpYF7CvtuF9uRhNSF/iZY +JBgtKrunavvzoSlP6dFNE78vxNI8el4CkOVInP+0XrPIfSsOiZu0h5vl8MAxW92ra5k 3EJg== MIME-Version: 1.0 X-Received: by 10.112.63.130 with SMTP id g2mr10457382lbs.28.1447665841106; Mon, 16 Nov 2015 01:24:01 -0800 (PST) Received: by 10.112.156.231 with HTTP; Mon, 16 Nov 2015 01:24:01 -0800 (PST) In-Reply-To: References: Date: Mon, 16 Nov 2015 10:24:01 +0100 Message-ID: To: Chris Riley Cc: PHP internals Content-Type: multipart/alternative; boundary=001a11c3c3243675800524a4f8fc Subject: Re: [PHP-DEV] Immutable modifier From: mailto.woden@gmail.com (Daniel Persson) --001a11c3c3243675800524a4f8fc Content-Type: text/plain; charset=UTF-8 Any differance from the final keyword? http://php.net/manual/en/language.oop5.final.php On Mon, Nov 16, 2015 at 10:15 AM, Chris Riley wrote: > Hi, > > There has been a lot of interest recently (eg psr-7) in immutable data. I'm > considering putting an RFC together to add language support for immutables: > > immutable class Foo { > public $bar; > public function __construct($bar) { > $this->bar = $bar; > } > } > > Immutable on a class declaration makes all (maybe only public?) properties > of the class immutable after construct; assigning to a property would > result in a Fatal error. > > class Foo { > public $bar; > immutable public $baz; > } > > Immutable on a property makes the property immutable once it takes on a > none null value. Attempts to modify the property after this results in a > fatal error. > > Any thoughts? > ~C > --001a11c3c3243675800524a4f8fc--