Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109277 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 85208 invoked from network); 24 Mar 2020 16:47:28 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 24 Mar 2020 16:47:28 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B05AE180509 for ; Tue, 24 Mar 2020 08:11:53 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-vk1-f169.google.com (mail-vk1-f169.google.com [209.85.221.169]) (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, 24 Mar 2020 08:11:53 -0700 (PDT) Received: by mail-vk1-f169.google.com with SMTP id m131so4903787vkh.3 for ; Tue, 24 Mar 2020 08:11:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=LJnBnlHxl+rNcW0swmBoF19r3YaiZ0IYMPRj8PgRBZY=; b=qAnAxuxotZk0/hl7mMTdE79Q6seJybjg8ytBfJcWcv10iCiFXp0pKtPUaP/J9tQI4p fKtMKbKFOWr3sqib47BpCm8G011qKRtCIWl6CDCEC3DRhgfR4Jk1Gk25ETu0ejGxoQ9T UhIPTBlFBQA46GXfo2hKMjsYtZ8H1uRlORzv5kaXfPO/28DrEj30BbL+SE1kfoJBzFQh NxGaSBrBXT12uSfcdMAfGxR2DLLWCp7V0xkO1uIizgDdJUktwvRvTz83K4Aj9AxI6TQC tGLgR/ZRpwa6wgWmxYy/n4TBlfwoERSFSR36CwhxZhCfw5kBuhiypCPrS2bLo0X5cb7e cTKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=LJnBnlHxl+rNcW0swmBoF19r3YaiZ0IYMPRj8PgRBZY=; b=h6y37Uhwk3rM0NyEid9jPkTiq+Qyk9rQg3HhiPnd08qjsvdXa7jfEyZuid2wpxssGH h0cL4wdeavCjBl1Iy3vzQpNUX63Ln4RQXSSlQGocoReSxwijR8zB9T+pVXZ6J1JiASOm 5H6a7bYeWTH8jh9dgV+/EOwNqoLj/E+5ioK0cwsGJsA1GyQgnpgBFVp0seQV1KClb5z0 rjOvD8PPAogd7VIOx8JzX4LyT0UQd4970yzQ8ViFSVC7aLZStJ5qB7l0GYnEtgyf1vw3 V/N6lHyZ5rhJCW6aO62FX9t1WNSITsqZIf3FwEd8ivgDpYkxxchCizzbCtjUIvSXof7y PA0Q== X-Gm-Message-State: ANhLgQ1P1eebpqmsTHb/pXMfwKYj+tnMBgiloO8bznF2E5IQpZwFWiIL ytU80yjaboEl6SD9u2faxnrHr7xcz4BhjGk4kmI= X-Google-Smtp-Source: ADFU+vtPsDrzcJG4iKmK87aYiSDOR+Njm+FFtCaxPyRpAZmzAicc+EsfyF1xzeMhRAqYmiO6G1nnM7RjpY/HY1plevA= X-Received: by 2002:a1f:bf95:: with SMTP id p143mr19513727vkf.29.1585062707195; Tue, 24 Mar 2020 08:11:47 -0700 (PDT) MIME-Version: 1.0 References: <1b781e1e-3f27-485b-ab47-5eeaf9496548@www.fastmail.com> In-Reply-To: Date: Tue, 24 Mar 2020 16:11:35 +0100 Message-ID: To: Larry Garfield Cc: php internals Content-Type: multipart/alternative; boundary="0000000000009bf16f05a19b2b75" Subject: Re: [PHP-DEV] Improving PHP's Object Egonomics: A broad analysis From: kocsismate90@gmail.com (=?UTF-8?B?TcOhdMOpIEtvY3Npcw==?=) --0000000000009bf16f05a19b2b75 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable > > If the answer to that is "well don't do that", then what's the > alternative? PHP offers no other syntax for evolvable immutable objects > than private properties with Wither methods. Making Wither methods harde= r > makes evolvable immutable objects harder. Unless there's some entirely > different approach I am not aware of to achieve the same goal, in which > case please share. :-) > For transparency purposes: the idea I presented during the discussion of "write-once" properties was to make the following syntax (or a similar one) possible in order to make cloning of these properties possible: > $self =3D clone $this with {property1: "foo", ...}; It would clone the object and in the same time change the listed properties (no matter if they have the "write-once" flag). It would also take visibility rules into account, so a private property could only be modified in the private scope. I think this idea would address your concerns, although I haven't received any feedback about it yet, so I'm not sure if it has any gotchas/edge cases that would make it or its implementation infeasible. M=C3=A1t=C3=A9 --0000000000009bf16f05a19b2b75--