Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115450 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 10611 invoked from network); 17 Jul 2021 08:40:17 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 17 Jul 2021 08:40:17 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 2CD241804C8 for ; Sat, 17 Jul 2021 02:04:41 -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.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-qk1-f180.google.com (mail-qk1-f180.google.com [209.85.222.180]) (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 02:04:40 -0700 (PDT) Received: by mail-qk1-f180.google.com with SMTP id p202so11245895qka.12 for ; Sat, 17 Jul 2021 02:04:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=newclarity-net.20150623.gappssmtp.com; s=20150623; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=4wex+OTZMKXk6t3NeGsPYcqQ8K15Y6tsrDSCqFO5V/A=; b=ot/DxQcmN0mmDv9cLDhoPSF/sTx/YBXLqQ25KanBcke5AA/qzZIbdBU1Eruyv8KrTS WmqDiuP046ImXzDFa+HMDb5oljjcnXbRjsm5oSxI7JtCJaPP/vPlDddCnl/cUDUuxiqm Iobkj85Z3n31flSQUpvmILKl/CDCMlWWmE2WfVIYEX3fhkkUR6QvgEpbQQuXbHe64d33 naH+mlhSQm4QzZyP/2sBntOsQCSqiS3YjMQQ7UzlP7+YNnCC6mmNMCEnlp5YiTUj6HJH vSLKUgV8YBlKkxuL3ZbhJLY3FQFjiCHG1b5bRoc8J3WyT2zpoHJpPtn8UfuzbkIaCEEW EBFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=4wex+OTZMKXk6t3NeGsPYcqQ8K15Y6tsrDSCqFO5V/A=; b=CVZYgYDrHNOm8TDDz+obKeZiAQzFNq1yL04fFEQZ7KgLVjld5C0vjBKGwvWF/W784m 5Xe6QpeXh/V2BxgNbydus7DszOs6TBUIj6VvlVLUtdJOm+zyN7ArCQyBBhymfGddd6ok 6p6H+m4x/1+wD7i1U21GMQMbj12lqu/zargpogK7m/zeEUEJwFCbd72jNY1m971IQYFI Jjg+v/ftoHlm5xoBKFLd6U5F3Ffmikwnc+/tJwpJk1JjNjhhc9FjG2vy/iDH/v9pQqCg 7HH4AphatIVm2LmWwk/AMhEZKQ+l/KanyTSHCZO3zz9cz6XjWiYL8PwJyNKzu1BOBzZ9 MNOw== X-Gm-Message-State: AOAM532aZy0ZKmXtVtXwip4NK6EfloBmmVVgaVxQThWmJPE7J/UiOFI3 aBHaj3DrJX24EpArLlnEz3WqTA== X-Google-Smtp-Source: ABdhPJwgdQTlBOytkMtJfLDmLU2NdMlQhPWFZiJ5tAChGisrh0yGNO48NAzCtfrp677fikyTlIXOZQ== X-Received: by 2002:a37:909:: with SMTP id 9mr13999886qkj.28.1626512679885; Sat, 17 Jul 2021 02:04:39 -0700 (PDT) Received: from [192.168.1.10] (c-24-98-254-8.hsd1.ga.comcast.net. [24.98.254.8]) by smtp.gmail.com with ESMTPSA id y1sm4982895qki.59.2021.07.17.02.04.38 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 17 Jul 2021 02:04:39 -0700 (PDT) Message-ID: <96778CB3-C753-45B9-971E-7D84E6F81381@newclarity.net> Content-Type: multipart/alternative; boundary="Apple-Mail=_DC8F3ED2-39F5-4267-8C7A-E6CC4BC8C97A" Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.7\)) Date: Sat, 17 Jul 2021 05:04:37 -0400 In-Reply-To: Cc: PHP Internals To: Eugene Sidelnyk References: X-Mailer: Apple Mail (2.3608.120.23.2.7) Subject: Re: [PHP-DEV] Readonly properties - immutability by default From: mike@newclarity.net (Mike Schinkel) --Apple-Mail=_DC8F3ED2-39F5-4267-8C7A-E6CC4BC8C97A Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Jul 17, 2021, at 1:40 AM, Eugene Sidelnyk = wrote: >=20 > > Having a "readonly" class where the properties are read-only by = default makes sense to me, but maybe the better way to do it is with an = attribute? >=20 > We already have such an attribute provided. It is called = [`#[Immutable]`](https://blog.jetbrains.com/phpstorm/2020/10/phpstorm-2020= -3-eap-4/#immutable = ). Actually, you are confusing PhpStorm's inclusion of PhpStorm-specific = userland attributes where the PhpStorm team are probably trying to drive = defacto-standard meanings for those attributes they documents with = attributes that has specific meanings and behavior recognized by PHP = itself. Nothing against PhpStorm =E2=80=94 it is my IDE/editor of choice and I = applaud JetBrain's leadership in this area =E2=80=94 but their = attributes are still just their attributes, not attributes defined by in = a PHP RFC. > If the intention is to add some logic for attributes, then unlikely it = is going to be accepted because attributes by definition are meta-data. = It doesn't add any logic for program. Actually, that is not true either. PHP already has one attribute that = PHP itself recognizes, named "Attribute." As Larry Garfield wrote[1]: = "The #[Attribute] attribute tells PHP =E2=80=9Cyes, this class can be = loaded as an attribute.=E2=80=9D =20 You can also see that future scope was explicitly envisioned[2] that = some small number of attributes might potentially be more than just = metadata. -Mike [1] https://platform.sh/blog/2020/php-8-0-feature-focus-attributes/ = [2] https://wiki.php.net/rfc/attributes_v2#future_scope = =20= --Apple-Mail=_DC8F3ED2-39F5-4267-8C7A-E6CC4BC8C97A--