Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115454 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 31417 invoked from network); 17 Jul 2021 14:33:31 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 17 Jul 2021 14:33:31 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 8B8F4180507 for ; Sat, 17 Jul 2021 07:58:02 -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-yb1-f177.google.com (mail-yb1-f177.google.com [209.85.219.177]) (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 ; Sat, 17 Jul 2021 07:58:02 -0700 (PDT) Received: by mail-yb1-f177.google.com with SMTP id r135so19838926ybc.0 for ; Sat, 17 Jul 2021 07:58:02 -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=/UiLgtcsTWu4VuAGoXjdmST0FpdLzzqWI8cQdfqE8S8=; b=OGu1nQ7PxtZPy9/0uFtPB1750UTHUcs92QTu0L3deivjlm1kgZOI36kpFAQ6feg21p tsefa/eRj+GNLB0oYlB1FKEheO/teC0g6o6xowBT9ocDN9OuoS7hF0CugjWXdwhm3GtC p+guSC7Nr/Q9RfcQO7qPSn8nyWzs+n7e+zHhd24Ay68gpSz987KWS1urPziUdiicuwXA AMQQNyoc/uB4I1db6iJLPw3VOTF7KyIjPYtkjzAAtSbUTil9GYt4431HO+7Tq9NkUq+e mpJCCVG2oz2mYpFa5ZpKgw4ItK0yD2QB6kyePxq/jfIN1BOjcwFqe5A3C0ytR7YaTuN2 bWiQ== 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=/UiLgtcsTWu4VuAGoXjdmST0FpdLzzqWI8cQdfqE8S8=; b=npYbyeza8YhG0xSkVWnEYgC/BCurkRSs9/0q+XbUyJboTPPzjvcY8Ig5cQCWMvgIjS P+/hltbg5TubKRL/K8hYrKGvBdtjkfqAg5bIH52DQVy4Rrvd1CajLol14xRL80uFl+X9 FITZyUYyqqaAtHsMQba/8PsDCFAiIBU4dDNraGwMdvTsIQWpkU9SDrmS2W3r0JETd4KN 8ij6r5OMBe7SLpFGknp57Z1Z48BQYnvF0Yj8UjmWCDA2uAqLfbm805oOO+sQoYIbl2vs vm5F7AJB+hQB0byoDscXXRu4Kx7o7T+I5PT5rWQCVlZjKoHV5GeyR3xVLwq7PRHXdW1l qBlw== X-Gm-Message-State: AOAM5305gyUgIU+XMGoDDua/GMTAmUdOjTkuhTH/BK1FTsbk/bkuqRdy /w1dlClJFZnbJk6KgeKi8Q38/WizEfE2CnrY7cg= X-Google-Smtp-Source: ABdhPJzs80fckFE9wZjLc7EvtUYijuVp8SQHR+A8v78hzBEHJOkimAhMaGXIIIrzkAfE+EhHzmY/7+M0CdEsFVqTnXQ= X-Received: by 2002:a25:d0cc:: with SMTP id h195mr20721220ybg.498.1626533881336; Sat, 17 Jul 2021 07:58:01 -0700 (PDT) MIME-Version: 1.0 References: <2edb4a2e-b337-14c7-c453-591eaa806668@gmx.net> In-Reply-To: <2edb4a2e-b337-14c7-c453-591eaa806668@gmx.net> Date: Sat, 17 Jul 2021 17:57:53 +0300 Message-ID: To: Andreas Leathley Cc: PHP Internals Content-Type: multipart/alternative; boundary="0000000000003656f905c752ee5b" Subject: Re: [PHP-DEV] Readonly properties - immutability by default From: zsidelnik@gmail.com (Eugene Sidelnyk) --0000000000003656f905c752ee5b Content-Type: text/plain; charset="UTF-8" I don't think the way it is going to be realeased is elegant solution On Sat, Jul 17, 2021, 2:47 PM Andreas Leathley wrote: > On 16.07.21 09:06, Nikita Popov wrote: > > We cannot make properties readonly by default, because that would be a > > major backwards compatibility break. > > > > If you're going for brevity, something you can do is omit the visibility > > specifier, as it is public by default. "readonly int $prop" works. > > Would it be possible to adapt constructor property promotion to support > this (as far as I tell, it currently does not)? Namely: > > class A { > public function __construct( > readonly int $id, > ) { > } > } > > According to the constructor property promotion RFC, the promotion only > happens when public, private and protected is used for an constructor > parameter. With the readonly RFC accepted, it would make sense to also > do constructor property promotion when readonly is used, to avoid the > explicit public, because readonly would also clearly define the > parameter as not-only-a-parameter. > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > > --0000000000003656f905c752ee5b--