RE: [PHP-DEV] [RFC] Amendments to Attributes

From: Date: Thu, 21 May 2020 06:06:51 +0000
Subject: RE: [PHP-DEV] [RFC] Amendments to Attributes
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-110229@lists.php.net to get a copy of this message
Hi Benjamin, It's good to hear that PhpCompikerAttribute can be merged, could you include it in the RFC as well? Thus I think people who support UserlandAttribute can agree with Attribute now as well. Regards, CHU Zhaowei -----Original Message----- From: Benjamin Eberlei <kontakt@beberlei.de> Sent: Thursday, May 21, 2020 6:13 AM To: Ben Ramsey <ben@benramsey.com> Cc: PHP Internals <internals@lists.php.net> Subject: Re: [PHP-DEV] [RFC] Amendments to Attributes On Wed, May 20, 2020 at 7:53 PM Ben Ramsey <ben@benramsey.com> wrote: > > On May 20, 2020, at 12:07, Benjamin Eberlei <kontakt@beberlei.de> wrote: > > > > 2. Rename PhpAttribute to Attribute in global namespace (independent > > of > the > > namespace RFC) > > > I suggested in a previous thread that we consider renaming > PhpAttribute to > UserlandAttribute, since this is the intent of the > attribute, and it helps distinguish it from CompilerAttribute. > > I noticed that the compiler attribute is actually named > PhpCompilerAttribute, so unless we change its name to > CompilerAttribute, I don’t think it makes sense to change > PhpAttribute to Attribute. > Perhaps we change it to PhpUserlandAttribute, for clarity? > Ah that's a good point that still needs to be clarified. We realized that PhpAttribute and PhpCompilerAttribute should be merged, because the difference doesn't make a difference to userland code and it complicates things. For example enforcing that PhpCompilerAttribute is just on internal classes would not work for generated stub code in Phan/Psalm and so on that "describe" internal code by imitating it in userland. This would not be allowed by the current implementation and lead to a compiler error, lets say if we imitated Deprecated for documentation purposes: <?php <<PhpCompilerAttribute>> class Deprecated {} This file could not be compiled by current implementation as an error would prevent Userland Deprecated class from using PhpCompilerAttribute. > > Cheers, > Ben >

« previous php.internals (#110229) next »