Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112643 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 44064 invoked from network); 29 Dec 2020 19:04:24 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 29 Dec 2020 19:04:24 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9F7991804E4 for ; Tue, 29 Dec 2020 10:38:54 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 29 Dec 2020 10:38:54 -0800 (PST) Received: by mail-lf1-f49.google.com with SMTP id s26so32686590lfc.8 for ; Tue, 29 Dec 2020 10:38:53 -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=It1bJHWKRObl4DAaLosao3DnI6XXKY10wCXiN5PLN38=; b=k3MvQctFcDFzMSdO4w2swhI4IJ/O3fylWcDcho+TXOYrdgKyGd1IMyjaC24mzzgXXb 9ImjRCf59hHO375N+qTE+CRCK2Zy8awNHKaf/t4pRYwWY40qK7QsNGvBaPuL6hv8kIJW zACKNok69M8n8e2X1MxaOniB0yDkSSoShGNYRyxqJWm3PyY0hopWXtTuZ8nfEbg8gLNU 1r2QZRA+F7G6mRtXC9AwBRbpZaNDMaz/X9FrUUebS5dArqKBYaD2IgurI8OAxTV49New IKELWeXXc1Ojlip+0ppM3wmXYWVTQ/EtnPtd7GBhuONw6E/juZNUXyBhA9iPysmOtifV +5Cw== 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=It1bJHWKRObl4DAaLosao3DnI6XXKY10wCXiN5PLN38=; b=GEYfUoZPwwQMP9wBaf8bmzgaLjQwOJm0YUrWci52eCnLorZuBzSogFfiXqRG9sZRi/ ZQUGeacYZV3H7h7WtaeZlXpAvfIy4lTF7X9LsV68a2sUXYBxKMakdPn1lK/I5FDGksBh 0mQruWhR2D80GFgnvvWCmp8ZzvVh0aNqOT0SgrXe/ifLo1U4FPAjcV68Xk9VKd0WI1RB Q5lJv48sj9jakhjlhB//FX2OHc7ng74k0yS1x8r5qEIod0EP4i6v/ye5CmKXb4ZeKsp8 CTDbAA43WK5Cqe6PlzMXvdaBWQ36Ly0APZJNvxk3kBVDcHDOhW42KHrdoI5nOZwIO2oI cBfA== X-Gm-Message-State: AOAM531XyNnphMW7kM0s+DzaC7yoNgt+Y99CA6CSWfi0Wp4QQAGhBItA dxAxAIjhwGm+4+FS9Ualp6cXCu8wTqWo8cfMuofr+PqfX0U= X-Google-Smtp-Source: ABdhPJyEHPZSIFKUpTSRpJ3G5vP/6AXb1c3dk4XJNlNsbZs9H/k44HXlUL+M9Ghu19rg1aTTq4/OkRnS5pMDe1WA4Mw= X-Received: by 2002:a19:cb05:: with SMTP id b5mr16993843lfg.61.1609267132433; Tue, 29 Dec 2020 10:38:52 -0800 (PST) MIME-Version: 1.0 Received: by 2002:ab3:7110:0:0:0:0:0 with HTTP; Tue, 29 Dec 2020 10:38:51 -0800 (PST) In-Reply-To: References: <1d0abb04-4987-43a9-85bc-bccc3bd6be9a@www.fastmail.com> <03108284-740a-4a5d-130f-15b2e67e9df9@mabe.berlin> Date: Tue, 29 Dec 2020 18:38:51 +0000 Message-ID: To: Larry Garfield Cc: php internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] Analysis of property visibility, immutability, and cloning proposals From: olleharstedt@gmail.com (=?UTF-8?Q?Olle_H=C3=A4rstedt?=) 2020-12-29 15:38 GMT, Larry Garfield : > On Tue, Dec 29, 2020, at 2:26 AM, Marc wrote: >> >> On 28.12.20 21:23, Larry Garfield wrote: >> > There's been a number of discussions of late around property visibility >> > and how to make objects more immutable. Since it seems to have been >> > well-received in the past, I decided to do a complete analysis and >> > context of the various things that have been floated about recently. >> > >> > The full writeup is here: >> > >> > https://peakd.com/hive-168588/@crell/object-properties-and-immutability >> > >> > I hope it proves stimulating, at least of discussion and not naps. >> > >> >> Thanks for the nice write up Larry! >> >> Is there a reason you didn't mention the proposal for immutable classes? >> (probably because it never went into a final RFC) >> >> https://externals.io/message/94913#94913 >> >> https://externals.io/message/79180#79180 > > Two main reasons: > > 1) It's not been discussed recently (see how old the dates are on those > messages), so I wasn't thinking about it. > > 2) An immutable class would in all practicality be the same as a class where > all the properties are initonly (or writeonce, but that was already > rejected). So any arguments for/against initonly apply in aggregate to an > immutable class. > > --Larry Garfield > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > > Instead of shoe-horning everything into the PHP object system, did anyone consider adding support for records instead, which would always be immutable, and could support the spread operator for cloning-with similar as in JavaScript or OCaml? They could be based on PHP arrays and thus be passed by value. Olle