Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114278 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 18783 invoked from network); 4 May 2021 20:57:57 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 4 May 2021 20:57:57 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 349E81804D8 for ; Tue, 4 May 2021 14:04:01 -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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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-Virus: No X-Envelope-From: Received: from mail-vs1-f42.google.com (mail-vs1-f42.google.com [209.85.217.42]) (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, 4 May 2021 14:04:00 -0700 (PDT) Received: by mail-vs1-f42.google.com with SMTP id o192so16941vsd.7 for ; Tue, 04 May 2021 14:04:00 -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=keLJjJL6Te7Sg3T93Io5rwWgIfJzeDJNUiFVgsfLpjM=; b=MooXC7pX52xUsSZeUV6yookirOqTcDOtvaO0U8IV/r2f7rLyzuBU1z5DfzQQ6qI5X1 3d6qcdxo4JXknjHQo7XxAdTuB5WIU8IxPZYcHKFfDuBjN1j/eq8gA0XytT6srkSJodk4 nmgaIAaSB3l3V608IR+kKVpUSk5vrDTqHrnBYzc3X8lq8kILxGO5vhEmrYu/sW/NnjOa 9lm5/yCkFJwhj36uaBLLG0QLE6K/Zuzk3W4gvXz+NPHMPvs9N0/mdSBOXV+osGRGvG3N bFi0KTLT7qAOpe22qYEW3skzSjsa3mSRal14DompInyQBnradw/INb7Y223TDTEbtsCV KZ8A== 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=keLJjJL6Te7Sg3T93Io5rwWgIfJzeDJNUiFVgsfLpjM=; b=NMpy0iSmdJ6EcQF3u2Xs2/wG6ywY8LLWX3VEIURp/kTkhEp/sot2ZHiSTWVz1alvp5 z6hrcJPYrtoH8tZGT/qXuWm8Io499anWUopCrlXLUqcPvT1pmyXSGXULtLdfQzgUc8XE EMPMX4aP6xmViW+HlsUuYB/gsSrvyEOnTh6hT2Mi7dDC4gck3HdQxyr32I/HqwIiywSL FqFOnXN8YsBvJOBZ9o6dkSntDRaBf4yEmx9a2M0mmt+o1Qv3SbBi5xnwZC1vCJggY8NK J/jyVaMg0XsHST/9CVjZaCVHJ6SKyhJnyoD+0Evq1jvObdfnGLS+7DsuEuNVFZXMVaEP yL+g== X-Gm-Message-State: AOAM533IzdrAcGb3HY3T/qSYuZcUfKfL4iju2wMoFtr3L8j6yaDGosaP Va92/rF3JuBSOKdMBS82Ru1EsaYTncZiqm78CHM= X-Google-Smtp-Source: ABdhPJwDMH8a9fQYTTtIno4sEiQAnKGUGSGurizeW/2HK51PS4kb/NQC1cSlm/ERgUObhKE5RQwveR8NTZsaTPlEC2M= X-Received: by 2002:a67:edd0:: with SMTP id e16mr24557474vsp.4.1620162239035; Tue, 04 May 2021 14:03:59 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 4 May 2021 17:03:48 -0400 Message-ID: To: Nikita Popov Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000bc849d05c1876a11" Subject: Re: [PHP-DEV] [RFC] Property accessors From: matthewmatthew@gmail.com (Matthew Brown) --000000000000bc849d05c1876a11 Content-Type: text/plain; charset="UTF-8" On Tue, 4 May 2021 at 06:34, Nikita Popov wrote: > Hi internals, > > I'd like to present an RFC for property accessors: > https://wiki.php.net/rfc/property_accessors > > 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. > > 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. > > 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. > > 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. > > Regards, > Nikita > I don't have a vote, but I've worked on a few ActiveRecord-style ORMs in PHP, and this is the sort of feature that would make me want to rewrite everything to take advantage of it. I've used property accessors in C# and really appreciated them. The 20% increase in performance over magic getters and setters is a nice bonus. Allowing the creation of engine-enforced private-set properties is another bonus, even though I'm already able to enforce that in my projects via static analysis. Best wishes, Matt --000000000000bc849d05c1876a11--