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 <kont...@beberlei.de> 
Sent: Thursday, May 21, 2020 6:13 AM
To: Ben Ramsey <b...@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 <b...@benramsey.com> wrote:

> > On May 20, 2020, at 12:07, Benjamin Eberlei <kont...@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
>

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to