Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:101908 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 12644 invoked from network); 23 Feb 2018 14:08:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Feb 2018 14:08:28 -0000 Authentication-Results: pb1.pair.com smtp.mail=pmjones88@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=pmjones88@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.47 as permitted sender) X-PHP-List-Original-Sender: pmjones88@gmail.com X-Host-Fingerprint: 209.85.214.47 mail-it0-f47.google.com Received: from [209.85.214.47] ([209.85.214.47:40238] helo=mail-it0-f47.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 36/25-01511-A50209A5 for ; Fri, 23 Feb 2018 09:08:27 -0500 Received: by mail-it0-f47.google.com with SMTP id v186so3272930itc.5 for ; Fri, 23 Feb 2018 06:08:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:content-transfer-encoding:mime-version:subject:date:references :to:in-reply-to:message-id; bh=8OgA3GPnyCTabYWe8aPUUJTM0DKPvQW2sX4V0pD/6ZQ=; b=JD7cMbr6FFaOnxiI+AUiNmunkcdFQm/GzykMLuO2zjR4Kn098y2qZUsiRlk/ztRmqg cmEITFtClzImdj+NDynJ1Oab2ZSk4gGzTTiOh+/o8Kq7oPjtZN2PDfaGkrYfQh+Vf47v xB1nt1kjuoZbHR6phqTT7RdQLXc4PhAg7V+d+mw+WxwVRPzrVsr4S4lYfy9zfGfBqKJH bLSjQYlJBjN4nkujr4csTHzy46TJ6Rc93GPtyyin8PgTipEKZ660WOb5zJKka3j04EpJ NYXIlQeUDZTKpwhtXe6yqQSDVDur8gKRGXRBnBSyt2/IorEOpcNjwGUnM2c+jzbMMV51 84sA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:content-transfer-encoding:mime-version :subject:date:references:to:in-reply-to:message-id; bh=8OgA3GPnyCTabYWe8aPUUJTM0DKPvQW2sX4V0pD/6ZQ=; b=iyXm8GNofCCQcdtviXlWpPm5I38K48ibTawOBERUUMMau6kKSFDyd5FjmlneLlEoTU Q2Xo71w8juT4o1V4iFuqfDCTGnJrppEWsdXo7vtBgQBEwnC2o6oenAElMqztq5tC6xe5 4RiaNUbomypEAUXDi5dhtnaplr5U34J1ejE2NsqflY5p0Ox74qFdvFMeHK5/o2kdOIbm d2Phg1iAdjQToKZRwxOmQaE88qWnoetALUg5SbvHR3DLQ9uckfzZK5yDt0p01Dm8QYSg QlAWDL5iwyVWdG4RdaxuB14HTzecY7qBaQdz/bggJb/cfSV7D10GBDm8cbCv3V/b6fhu E8Kg== X-Gm-Message-State: APf1xPBiOhewGNSBtbrk6Sj1vT7JsT1QxQVV6amBGvZkaCeJIOweGVeS NEjipOoypRdNEEYV3w6VyVs= X-Google-Smtp-Source: AH8x224BzOX9cE18kd7ErzAR9FhoqVCJsHM7WOAeRt8rEhZBGLO5THjbMInt9C6HNZ+lh4AveGVLag== X-Received: by 10.36.131.3 with SMTP id d3mr2375141ite.149.1519394903685; Fri, 23 Feb 2018 06:08:23 -0800 (PST) Received: from samurai.attlocal.net (107-223-28-39.lightspeed.nsvltn.sbcglobal.net. [107.223.28.39]) by smtp.gmail.com with ESMTPSA id d186sm1377797itd.22.2018.02.23.06.08.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Feb 2018 06:08:22 -0800 (PST) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 11.2 \(3445.5.20\)) Date: Fri, 23 Feb 2018 08:08:20 -0600 References: To: =?utf-8?Q?Silvio_Mariji=C4=87?= , PHP Internals List In-Reply-To: Message-ID: <2B23EFFB-21C3-49E4-9000-B2E0F97E93A2@gmail.com> X-Mailer: Apple Mail (2.3445.5.20) Subject: Re: [PHP-DEV][RFC][DISCUSSION] Immutability From: pmjones88@gmail.com (Paul Jones) Hi Silvio, I like the RFC. * * * I would like to see arrays allowed as immutable properties. In I wrote that arrays are = "probably not practical in most situations" because you have to = "recursively scan through array properties to make sure that they = contain only immutable values". However, I think if the scanning happens at the C level it is not such a = burden. John Boehr implemented it for the immutable ServerRequest object = in ext-request and it has worked = well. If you do allow arrays, they would have to follow the same rules as the = immutable object. Alternatively, perhaps an ImmutableArrayObject would be a good addition = or followup to the RFC. * * * Some further points to harden the implementation: - I see that resources and references are disallowed (which is good). If = you have not already done so, you may wish to disallow streams as well. - You might want to disable setting of undefined public properties, so = that you cannot "add" mutable public properties to the immutable object. - Disable the constructor after it has been called, so the object cannot = be "re-constructed" in place. * * * That's all I can think of for now. Thanks for putting this together. --=20 Paul M. Jones pmjones@pmjones.io http://paul-m-jones.com Modernizing Legacy Applications in PHP https://leanpub.com/mlaphp Solving the N+1 Problem in PHP https://leanpub.com/sn1php