Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114264 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 56346 invoked from network); 4 May 2021 10:28:07 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 4 May 2021 10:28:07 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 5559F1804DB for ; Tue, 4 May 2021 03:34:08 -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=0.6 required=5.0 tests=BAYES_50,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-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) (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 03:34:07 -0700 (PDT) Received: by mail-lf1-f43.google.com with SMTP id 2so12558295lft.4 for ; Tue, 04 May 2021 03:34:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=C9xihWgMp1MnaCyQx72ktBMizRkDuzf48/JUQPKSRGI=; b=sT66phZ4F+LFxaQW22J4NlkyC6tC48uEwHDFo+/w+niaaV1ZAA6IVCeYj26Ma15PeR VUGbbG14zGGOJxLZzok5Rn+FP46940WDZvkxNkZvc42eJKX37T2EFpmY6TqWHTh9gk11 omPwrCB8lPGb+GxVvqbjgaQDMhRjXN6HAK5vugfLG8OcLAPyZDSNHVkibx8PriyFQCog ScJ8+z/yzd4U9bEF2KnpgugIN/+5LxECRvlZ+P2f939VdQszpLw5SFQe1fae2MJ9CZmx O+zxuwmawjvU930GGdyqXFIZKqTTUS3IKMn2ASs5UgNqhN5JodhtCXGAOa/a1ymJ/Pzl ZZpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=C9xihWgMp1MnaCyQx72ktBMizRkDuzf48/JUQPKSRGI=; b=jOuzdYi/T/SPF9143SiP9QahDSUosESfSPoyn5lUo6l0B75NGoEHvMNQ0w2TkXQeU4 zqdoo2UgD8/foccktp+EOdHzZT8ujEntCE5MQiHmTtlSdxSWbA+va2dk4u6K8E/MAN5E biNPjHwHdIkwWdd5LYffhhTfgnulsopYOZBj4jE37qBwW1AzQ7zewdVp2o0gPMKL6zqD 8d+54bvNVdzajpmYCddtp2A5WsEvrfQkE4X7LU4SLePl21L8wGNuWxPgXShoI/WwhLEa RbvE6YsLYbnSrwfBONYdBdnyMDnev/8V71RhTeQ7m1g970l2aCk16cFJ46l4qpaah3+d 9oNw== X-Gm-Message-State: AOAM532d1DTgetcPtnfitBal1jZ491CVp15c5uOBuO0Cp4LfU+76sM0J IHszb8oJ1DW4ydoE/dU7vmoqRxDJSW6WqHQwXYuBS9r9eKK9kQ== X-Google-Smtp-Source: ABdhPJwb/RKBdRhuFD1uk8HhvGjDKL0kL+FzJc498VtE1OEUhZNZs/iChwCgyq4LOOEp3kUxA8KR5ibcc/tVSt2LniA= X-Received: by 2002:a05:6512:2399:: with SMTP id c25mr7610386lfv.286.1620124442376; Tue, 04 May 2021 03:34:02 -0700 (PDT) MIME-Version: 1.0 Date: Tue, 4 May 2021 12:33:46 +0200 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary="000000000000e13d9405c17e9d05" Subject: [RFC] Property accessors From: nikita.ppv@gmail.com (Nikita Popov) --000000000000e13d9405c17e9d05 Content-Type: text/plain; charset="UTF-8" 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 --000000000000e13d9405c17e9d05--