Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:101906 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 9247 invoked from network); 23 Feb 2018 13:40:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Feb 2018 13:40:37 -0000 Authentication-Results: pb1.pair.com smtp.mail=marijic.silvio@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=marijic.silvio@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.172 as permitted sender) X-PHP-List-Original-Sender: marijic.silvio@gmail.com X-Host-Fingerprint: 209.85.220.172 mail-qk0-f172.google.com Received: from [209.85.220.172] ([209.85.220.172:37108] helo=mail-qk0-f172.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4F/74-01511-4D9109A5 for ; Fri, 23 Feb 2018 08:40:37 -0500 Received: by mail-qk0-f172.google.com with SMTP id y137so10761929qka.4 for ; Fri, 23 Feb 2018 05:40:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=AUJk/jhiGchhgfmSnuGY37oOXiPCvu/SxlTdu7ExhU8=; b=qQOvGkcSMz8yrfxX0ZMfqDt2iwAGxlleQF9OODIfaePUglMzJ7y+t3wDsmPFX8ytBE 9YdAjmdf38UX2STnyIbmA7XOdCqMiam/CwrHiuDLNZJbsCzQbbXdf5C/q/QEab4LkRZX hIHD6LMxSTXYzH2/OA6Fhdw0lpadE6U8FM/eRhhLBZdCySyttzrViy3HE19KqSOenbF/ TWXCFxEFWRjFB4jtXGQ8oRc6pldrLqjU7CM7BWkyQ3oNEgcgpIdXmLLi7XSk9gTtzxsQ Gu01s0p/D36qXVo2pDH7gOr1i64/2pg4x1nDRokOcqtIuV2V9AcQQ7D6m2Mh8C/Qmtxe su7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=AUJk/jhiGchhgfmSnuGY37oOXiPCvu/SxlTdu7ExhU8=; b=cYaKW5W76QFjBmNDYbgi5oOtcXGCHDhJr1+LwCvpL+SPNVgbcP40TsmZcDSTgXfT+u QkajMRmfzA4arRQU4eA+bcPcOJ5frwt7vSlbaAN6IbEyOYOk40BnmRKx3VLrJRXYvX2n qs3/p8Rc2VUt6vmxajcdeEG5ZuntroO+32WteqcXIg/0exmcRTnN7nK3quBROBNFjS8F Di532ivXYx098M3IY8Qq5yvPXZBinSllA7KWGjVNIBx31LRK6dR1Oz+6A5O+2Aenwb55 +E86F+qF8WaXeV15ImMEq0w0gRPl0NYWbBPaBfi6/tnX0FX18TY9YIIC4EdYXF1jBNq6 mBcg== X-Gm-Message-State: APf1xPDGJ0jSjwIE/vYa/iPgm34erG0KQRwqgZq95R2zyQrasvA5THyX IAnXd7rp4eTrDhAjbG3rSRaUfh4KK363vJI0Xg4= X-Google-Smtp-Source: AG47ELsOjkrvfQ4zMriI7RHoa2Pg8HAjlHi0u4pILlEfnUc1q/7H0f3ZGQeFk7rtfcpRHtcWKAaq2m40kl4gUh0PMGE= X-Received: by 10.55.8.132 with SMTP id 126mr2511173qki.10.1519393233600; Fri, 23 Feb 2018 05:40:33 -0800 (PST) MIME-Version: 1.0 Received: by 10.140.33.133 with HTTP; Fri, 23 Feb 2018 05:40:33 -0800 (PST) In-Reply-To: References: Date: Fri, 23 Feb 2018 14:40:33 +0100 Message-ID: To: Rowan Collins Cc: PHP Internals List Content-Type: multipart/alternative; boundary="001a114c19f8f684a80565e14dd7" Subject: Re: [PHP-DEV][RFC][DISCUSSION] Immutability From: marijic.silvio@gmail.com (=?UTF-8?Q?Silvio_Mariji=C4=87?=) --001a114c19f8f684a80565e14dd7 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Rowan, I agree that RFC needs a bit refinement which I hope to do during ongoing discussion here. Originally you couldn't assign following types to an immutable property - *Resource* - *Instance of none-immutable class * Now I had to resort to also add *array* to that list. Regarding your question about references, yes you can obtain reference to an immutable property but you can not modify that property by reference. In that case it will throw fatal error, but I agree that it would be better to throw exception, I will include that in RFC. Thanks for the support I really appreciate it. Regards, 2018-02-22 10:57 GMT+01:00 Rowan Collins : > On 20 February 2018 at 11:25, Nikita Popov wrote: > > > On Tue, Feb 20, 2018 at 12:20 PM, Silvio Mariji=C4=87 < > marijic.silvio@gmail.com > > > > > wrote: > > > > > Hi, > > > I am starting this discussion again after a year since this RFC was > > > created. From discussions with people in the community some suggestio= ns > > > came up regarding issues that were main reason that development on th= is > > RFC > > > stopped. RFC is updated along with implementation (link at the bottom > of > > > RFC). I'll be more then happy to answer all questions. > > > > > > Link: https://wiki.php.net/rfc/immutability :) > > > > This definitely seems like an exciting addition to the language. Some > clarifications: > > > This sentence in the RFC is rather confusing, "Any references to objects > ... cannot be references to scalars ... or may be ...". I think it's just > reiterating things said elsewhere in the RFC, but could maybe be reworded= ? > > > Any references to objects passed into an immutable class constructor > cannot be references to scalars or may be immutable class instances. > > A set of bullet points of what types can and can't be assigned to an > immutable property might be useful. > > > The example under "references" shows a reference being successfully taken > to an immutable property, but then being considered immutable itself. Is > there any performance penalty to tracking this extra state? I know > references have caused problems in other cases, like the typed properties > RFC. > > > What kind of error is produced when you attempt to write to an immutable > property? I would expect some sub-class of Error to be thrown, but the RF= C > currently just says a fatal error. > > As I say, I like the idea, and thanks for working on it. > > Regards, > -- > Rowan Collins > [IMSoP] > --=20 Silvio Mariji=C4=87 Software Engineer SMSGlobal --001a114c19f8f684a80565e14dd7--