Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110782 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 23058 invoked from network); 29 Jun 2020 16:55:48 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 29 Jun 2020 16:55:48 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B831E1804F4 for ; Mon, 29 Jun 2020 08:44:31 -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-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-il1-f174.google.com (mail-il1-f174.google.com [209.85.166.174]) (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 ; Mon, 29 Jun 2020 08:44:31 -0700 (PDT) Received: by mail-il1-f174.google.com with SMTP id t27so9913060ill.9 for ; Mon, 29 Jun 2020 08:44:31 -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=L8naHlDb9PmIPY1Uz9D7+GHhOXGLbMOZj6n+6olSyEk=; b=XDWwk97dP12q04op463vbvBs/W7bm5Cs6n1EYUOyeecUy7DPHcZ2+4SuFtXDGlPCEh +nv05P8xBhi3FLOLfPPDlem7U3KXAPsG/NYVjjU55IOC/C4681gyVO1Q+/y3tB30nIkC 9IZ4Da3F1VZgGXSCgQoz4YC97vg9MUvLdWLPdaLbl5It9AOiRAkijk2qcsc0y/entC4K aOr2bg7CB/J3+jd2Gu5a05KAc8WflPxtWlDY27Wg9sxT0k4rU/53mah1tZFvwVIdzNmi yFe9wrwHIXrML5StmJsxaixMkL6VTbhsEO/3RRKMFSU56h+m/1tJ2Yek5HBTI3qOH2+H 37Nw== 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=L8naHlDb9PmIPY1Uz9D7+GHhOXGLbMOZj6n+6olSyEk=; b=J17YXKO7kRkX6qx6EZm+ln/2FUjatRxwy+zpEyhw3N/+BxBikq+53LmoMTknlVB/0e UcLYn3DMLcsNroQLP9bDQo3QcAiXus5p9ES5v3m2qF2Q929Yoqk0IHiomhj4QvYC2/Jj MolzR4GvnhTq0YEMg2xdxx+XiyBaIodnZYnRtEtzMoRfCfat4MwNQ5YK0Fcb5927eow3 vgutitSEMBjmqgQaCNuiJFsrX0Y+4ybm4UkLtxVvCLgk4zgC1oSoF5GWwbUSst5h2ubi g22zYliCHcG1POsCEad0upQ/Ey9IIdQQdTjVBFrqvTq0OGM4fsIq3mntTeSsI+GmZKgs UAbg== X-Gm-Message-State: AOAM5337oLmgCcaAOuUmhIWKAOmE/Su78ccWdnMfJsfqL82YU6l4BB3D d+npzNQlA+RgTILEoM/vCxYgtbeE0klIDXGtPb0= X-Google-Smtp-Source: ABdhPJy63ucQejyG9YdDcM9XJr3oEgA9BhI6LoDgapKVHttZtFP8fpdd2Fj/huu3W+uJTpAFkDupKyqacMRDU/JV2yo= X-Received: by 2002:a92:cec1:: with SMTP id z1mr4068944ilq.282.1593445467797; Mon, 29 Jun 2020 08:44:27 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 29 Jun 2020 17:44:16 +0200 Message-ID: To: =?UTF-8?B?QW5kcsOpIFLDuG1ja2U=?= Cc: PHP Internals List Content-Type: multipart/alternative; boundary="00000000000013bed405a93aefb4" Subject: Re: [PHP-DEV] [RFC] Property write visibility From: ocramius@gmail.com (Marco Pivetta) --00000000000013bed405a93aefb4 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hey Andr=C3=A9, This does indeed seem to cut into the traditional property accessors scope. I'm no longer seeing a reason to have property accessors, since immutable state (and promotion thereof) is much more relevant to fight bugs and improve application performance and maintainability. Therefore, I would endorse re-visiting the RFC at https://wiki.php.net/rfc/write_once_properties instead. M=C3=A1t=C3=A9 also linked today ( https://twitter.com/kocsismate90/status/1277625002720968704) that C# 9.0 is getting init-only properties, which looks similar to the RFC linked above. Assuming we solve annoyances around cloning, that would be a more sensible way forward, while property accessors seem to perpetuate the bad practice of getters and setters, which are the main cause for me having to fire up a debugger in any environment. Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/ On Mon, Jun 29, 2020 at 11:42 AM Andr=C3=A9 R=C3=B8mcke wrote: > Good morning Internals, > > I'd like to start discussion on a new RFC proposing a way to be able to > (optionally) specify property > write visibility, separate from read: > > https://wiki.php.net/rfc/property_write_visibility > > This enables readonly, write-only and immutable like semantics for PHP's > properties. > > These are the common use cases where users tend to resort to magic method= s > or setter/getter > methods. This proposal will as such avoid unnecessary boilerplate, makes > coding easier and more > ergonomic, and in the case of magic method usage improve performance. > > > Best, > Andr=C3=A9 R=C3=B8mcke > --00000000000013bed405a93aefb4--