Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114299 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 76795 invoked from network); 8 May 2021 03:50:43 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 8 May 2021 03:50:43 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id F0CB41801FD for ; Fri, 7 May 2021 20:57:35 -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.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-qt1-f178.google.com (mail-qt1-f178.google.com [209.85.160.178]) (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 ; Fri, 7 May 2021 20:57:35 -0700 (PDT) Received: by mail-qt1-f178.google.com with SMTP id f8so3992391qth.6 for ; Fri, 07 May 2021 20:57:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=newclarity-net.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=YgsWnrQ0bi7WSkiblQqrThl+6/jU99zj3U//h4v54WM=; b=sCZtfv1BIk9qvlmRyNRw9cgDX+HMQkobkpa2KJtnlU/kdPr0MSYHI2jmKnnD4zHcij dtYKvvOZsrWoqMQpQ9sjZkcQlYG729cBIXbtqtbxaEeZT/LaLbC0AgHErd/nNFqZDV7m gs7HM9OACVQeDvUj5+WELLDq8ZrWHjee8EnsVIrKAHKfk/UUI7kyag5ZCbLVuK+vFR2h 1plj24ZwH7vY31GLVMRN5ZP/V9ZSv2ROyWwoDMglRknrQo0BVr5v4zBwuizKFY1nsuiQ +oGMBek4LyDjYANzQsiDU3hXJ8lM5jYqWEmeJ3F0i/O282+hGxsmBU1QVPjypZ+jjtAy m5lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=YgsWnrQ0bi7WSkiblQqrThl+6/jU99zj3U//h4v54WM=; b=XODUvwm8/W5DAbaA2UrdeCenoTKvyE1q954jTd1B+ndoN2/cDQnhsLUizmQ+AMNpOl Dwi79y7ByvwjEKyTIOqKNuZPIAQuiAQhbzSYVgY4ybNKmJ4u7sTwCmvduwXy4euPqk5Y xsl0b/k1bOrZ5Tj4nLBcEbSCzudR/FDwmdcTWPz/Gq0bYsPxtfGTgG2Q15sTpS2n7KFr dxOxP6s6vIXVANkBkP6mhRZGAlAxZnk19UCVoKf23xgXQEAypCkZxfbBsUfbwlvqUIOv qY3HzB6L97Iej+Vb8derb2ZTfp0DRzLGMyGAME8wO7nZW8aLjTJf/0QY2x0+Hq8ydOfB Kc1g== X-Gm-Message-State: AOAM531C8ByInTmDqLLDiP8NcYsPe5rIscgYe5lSo58ChkybGBt6E129 2mocfQHYwSnjEASkAT9MUjB8vg== X-Google-Smtp-Source: ABdhPJxJXAnPeyU1hmwvifhMSVL6ZkzeHPSyJja9/sPioOa5VcPOk9H9khOoe8xqqqh0hIBKyB3jMg== X-Received: by 2002:ac8:6e87:: with SMTP id c7mr12158093qtv.358.1620446254639; Fri, 07 May 2021 20:57:34 -0700 (PDT) Received: from [192.168.1.10] (c-24-98-254-8.hsd1.ga.comcast.net. [24.98.254.8]) by smtp.gmail.com with ESMTPSA id p1sm6096205qtq.12.2021.05.07.20.57.33 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 May 2021 20:57:33 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.6\)) In-Reply-To: Date: Fri, 7 May 2021 23:57:32 -0400 Cc: PHP internals Content-Transfer-Encoding: quoted-printable Message-ID: References: To: Nikita Popov X-Mailer: Apple Mail (2.3608.120.23.2.6) Subject: Re: [PHP-DEV] [RFC] Property accessors From: mike@newclarity.net (Mike Schinkel) > On May 4, 2021, at 6:33 AM, Nikita Popov wrote: >=20 > Hi internals, >=20 > I'd like to present an RFC for property accessors: > https://wiki.php.net/rfc/property_accessors >=20 > Property accessors are like __get() and __set(), but for a single = property. > They also support read-only properties and properties with asymmetric > visibility (public read, private write) as a side-effect. >=20 > The proposal is modeled after C#-style accessors (also used by Swift), = and > syntactically similar to the previous > https://wiki.php.net/rfc/propertygetsetsyntax-v1.2 proposal. >=20 > While I put a lot of effort into both the proposal and the = implementation, > I've grown increasingly uncertain that this is the right direction for = us > to take. The proposal turned out to be significantly more complex than = I > originally anticipated (despite reducing the scope to only "get" and = "set" > accessors), and I'm sure there are some interactions I still haven't > accounted for. I'm not convinced the value justifies the complexity. This is an amazingly comprehensive proposal and I commend you for all = the effort. > So, while I'm putting this up for discussion, it may be that I will = not > pursue landing it. I think a lot of the practical value of this = accessors > proposal would be captured by support for read-only (and/or = private-write) > properties. This has been discussed (and declined) in the past, but > probably should be revisited. Adding property accessors to PHP could significantly improve robustness = in userland code. The KEY benefit is how userland classes could evolve = in complexity as required *without* breaking a classes' API. That = benefit cannot be overstated IMO. If this proposal needs to change, I hope you continue to ensure it can = provide zero breakage during evolution of userland code. -Mike P.S. I also concur with Larry Garfield and am uncomfortable with the = magic `$value` variable. I would prefer to always be explicitly = specified in parens on =E2=80=94 e.g. `set($var)` =E2=80=94 if it needs = to be used in the RHS of an assignment inside the set block. But this is = a trivial concern compared to the KEY benefit mentioned above.