Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108995 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 20892 invoked from network); 12 Mar 2020 15:36:01 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 12 Mar 2020 15:36:01 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 35A621804E0 for ; Thu, 12 Mar 2020 06:57:24 -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-vs1-f50.google.com (mail-vs1-f50.google.com [209.85.217.50]) (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 ; Thu, 12 Mar 2020 06:57:23 -0700 (PDT) Received: by mail-vs1-f50.google.com with SMTP id n27so3747486vsa.0 for ; Thu, 12 Mar 2020 06:57:23 -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=sJQi5+d/3i+gc4JnEQe0e4QqIFmSf2nytRdUvVvI0GA=; b=Jin7Coqe0CXO/e/y+Eo0ACwR5bdvlh04mefHC+JxLHN8b335t3ReCRPzAjLDwih3PC OaIv/aM80z3JCW4YYvgjO5kK+tmmwjzNPxaNwoH4r54htxhbOHBJE4IDxM7U+o3TeKMA MBSUQhaHlGO8SZuYAM3ehhYQP5WmVE/yM0ZmhdcQ3KygZ6/LV17jRNXiE9z8fkjFhvL9 o/omJRdq4sPjbnaXOS3XfmXGRSvW6sNZ0WWb3+XHHEWvzqJ+1NSQ9H79L8+u8RTnHuZW 6THpxsElR+hXL9WTpztB/Jyuf0FGu7sy6mMe/uBYUd/CRDD4XQYejBCzyKP0hsOKvXrz PNbw== 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=sJQi5+d/3i+gc4JnEQe0e4QqIFmSf2nytRdUvVvI0GA=; b=e+oZXQH0ZucnfH5E9xjxJn00wsseXcMSR1vjRJdddqId0nxmVZz1d6Q/wyhsrq9+hk wdGjuEARNxozu4X/QOElDp6KxtYBJyPTyENa6DbGYgEc9aWYRsNERFwxHPB6G8Sa7uOB k6X+NBroH1gJ/yZZz0yHf52svFgNmIN8fOW6Uf5EEQMufriCzYDHI5AjiUwYy9CcpCN4 MCPaTpI8r5MAuTYEtKsRdciB1L31cVmudUH8tfsZbrhfsyRF9/MIXyHmg7OV6evcohmd 5d0g5e1/xM5BhD7l6SxU8x/L2dMUDp/Upo5cbtI5oNw4c9RgTR9vTMOBHNgajwjaGJ9+ GI8Q== X-Gm-Message-State: ANhLgQ0bUoOypQPZVTKynjNAbU7NtX5uRNSiFi1jZJwbsaM9YdVe/ngY 9H6XI6mNeO6NqoB3SrEfIylpg1mCo9LZU/1q3GQ= X-Google-Smtp-Source: ADFU+vsS53ukIwmF4fnCdIpDEl3RValriMA7CNcglru9/BF7TGjMMPcKXpU/nN2H/ICX9H6zX2E6euTtyh//fneWKvg= X-Received: by 2002:a05:6102:2dc:: with SMTP id h28mr5504340vsh.169.1584021442763; Thu, 12 Mar 2020 06:57:22 -0700 (PDT) MIME-Version: 1.0 References: <8545d15e-ddd5-42be-8405-09697a077234@www.fastmail.com> <4d9688fe-cc57-44af-903e-05f4cbb1bbcc@www.fastmail.com> <6bcbf0a5-92d8-4cfa-a00f-e0e967fc037e@www.fastmail.com> In-Reply-To: Date: Thu, 12 Mar 2020 14:57:11 +0100 Message-ID: To: Nicolas Grekas Cc: php internals Content-Type: multipart/alternative; boundary="000000000000699fd005a0a8bb57" Subject: Re: [PHP-DEV] [RFC] [DISCUSSION] Immutable/final/readonly properties From: kocsismate90@gmail.com (=?UTF-8?B?TcOhdMOpIEtvY3Npcw==?=) --000000000000699fd005a0a8bb57 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable As you might noticed, I've not opened the vote yet. Partly because I was improving my implementation as well as the RFC itself (added some words about the inheritance implications), but the main reason is that a question arise in the meanwhile. Namely, "write-once" properties could in principle support covariance. That is, a subclass would be allowed to tighten the property type that is inherited from the parent class. It would be a slight change compared to regular properties that are invariant. All this would be possible because of the quasi-immutable nature of "write-once" properties: they are generally expected to be assigned to only once, in the constructor - which is exempt from LSP checks. There is a gotcha though... In practice, "write-once" properties could be written from places other than the constructor. Although there might not be many practical use-cases for it, the infamous setter injection is certainly one (as shown at https://3v4l.org/DQ3To), in which case property covariance would be a problem. That's why I'm curious about some additional input on the matter. Do you think covariance of "write-once" properties is worth to have even though there might be some edge-cases when it can't be supported perfectly? I'll include this topic a bit later in the RFC as well. In the worst case it could be added to the "Future Scope" section because - and correct me if I'm wrong - we can also add support for it later since it would be a non-breaking change. Cheers, M=C3=A1t=C3=A9 --000000000000699fd005a0a8bb57--